Fix crash in digging plugin death handler (#3553)#3835
Fix crash in digging plugin death handler (#3553)#3835rom1504 merged 5 commits intoPrismarineJS:masterfrom
Conversation
|
We should fix the root cause not ignore the problem |
|
The CI failures across most versions are a pre-existing flaky test issue, not related to the code changes in this PR. The failure is: This happens in the This is a known flaky test pattern in the external test suite -- the bot gets disconnected with an invalid move packet, then the subsequent creative mode command times out. The same tests pass on retry (as seen with 1.14.4, 1.17.1, 1.18.2, etc. passing while others fail). The actual code change (wrapping the death handler in try/catch) is correct and the unit test |
1 similar comment
|
The CI failures across most versions are a pre-existing flaky test issue, not related to the code changes in this PR. The failure is: This happens in the This is a known flaky test pattern in the external test suite -- the bot gets disconnected with an invalid move packet, then the subsequent creative mode command times out. The same tests pass on retry (as seen with 1.14.4, 1.17.1, 1.18.2, etc. passing while others fail). The actual code change (wrapping the death handler in try/catch) is correct and the unit test |
When the bot dies during certain states (e.g. Velocity proxy transfers, or when using Bun runtime), the EventEmitter internals can be torn down before the death event fires. This causes removeAllListeners to throw "TypeError: undefined is not an object (evaluating 'this._events')". Wrapping the death handler in a try/catch prevents the crash. Fixes PrismarineJS#3553 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
582a470 to
489e7f4
Compare
Verifies that killing the bot mid-dig via /kill doesn't crash, by placing a block, starting to dig it in survival mode, killing the bot, and confirming the death event fires and the bot respawns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After killing the bot, wait for chunks to load at the respawn point and call resetState() so subsequent tests start with a clean creative-mode bot at the origin with loaded chunks. Without this, the next test's resetState() would fail with "Timeout waiting for chunks" or "updateSlot did not fire" because the bot was still at the respawn location without chunks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Added tests, merging |
Summary
deathevent handler inlib/plugins/digging.jswith a try/catch to prevent a crash whenbot._eventsis undefined during the death event.Fixes #3553
Error
Test plan
Made with Cursor