-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgepriority:p2Priority P2 (medium)Priority P2 (medium)
Milestone
Description
Problem
cleanup() selects idle workers based on a snapshot (!w.busy and lastUsed) and then calls terminateWorker(worker). There’s no re-check before termination, so a worker that becomes busy after selection can be killed mid-request, causing spurious failures.
Evidence
src/runtime/optimized-node.ts:cleanup()computesidleWorkersonce, then terminates each without verifyingworker.busyat termination time.terminateWorker()does not guard againstbusystate and immediately rejects pending requests.
Acceptance criteria
- Re-check
worker.busy(and optionallylastUsed) immediately before termination; skip termination if it is no longer idle. - Add a test that triggers cleanup while a worker becomes busy and verifies no in-flight request is terminated.
Metadata
Metadata
Assignees
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgepriority:p2Priority P2 (medium)Priority P2 (medium)