Skip to content

[autofix.ci] apply automated fixes

346f824
Select commit
Loading
Failed to load commit list.
Open

Stop dispatching parent messages to self.onmessage in node:worker_threads workers #29215

[autofix.ci] apply automated fixes
346f824
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Apr 12, 2026 in 36m 21s

Code review found 1 important issue

Found 3 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/js/node/worker_threads.ts:458-461 Stale wrappedListener slot in removeListener leaks messageListenerCount after on→off→addEventListener

Annotations

Check failure on line 461 in src/js/node/worker_threads.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

Stale wrappedListener slot in removeListener leaks messageListenerCount after on→off→addEventListener

Aliasing `fake.removeListener` to `MessagePort.prototype.off` (lines 458-461) introduces a regression: when a listener is registered via `parentPort.addEventListener('message', fn)` after previously going through an `on`→`off` cycle, a subsequent `parentPort.removeListener('message', fn)` silently fails because `.off` resolves the stale `fn[wrappedListener]` slot (never cleared by `off`), finds no matching entry in `trackedByListener`, and returns early without calling `releaseListener()`; `mess