Turbopack: reap dead worker threads and fail their in-flight tasks
A worker thread that died unexpectedly (boot failure, crash, OOM, a
loader calling process.exit) was never reaped: the JS loaderWorkers map
retained the dead Worker, the pool kept handing its id out as healthy,
and each assigned task queued its payload on a channel no consumer
drained and then waited forever for a response.
- Report Worker error/exit to Rust (capturing threadId at creation: it
is -1 by the time the exit event fires) and fail the pending creation
when a worker dies before announcing itself.
- Pair creations with acquirers by a nonce instead of a global FIFO that
mis-paired across pools and after canceled/failed creations;
terminate unclaimed workers instead of retaining them.
- Wake in-flight tasks with a per-worker death signal so they fail
instead of hanging, remove the dead worker from the pool and its
routed channel, and never return a dead worker to the pool.
The causal e2e schedules process.exit inside a loader: baseline hangs
the compile forever; the fix fails it with a crash issue and recovers
on a fresh worker.