Repository navigation
fix(compression): drain the worker pool queue when worker construction throws - #12755
Conversation
|
Follow-up issues filed for the out-of-scope root causes:
|
|
Independent field confirmation from a self-hosted Docker deployment (standalone build of Symptom. With #12542's idle-terminate applied, worker threads stayed flat but the main-isolate heap still grew by roughly 5 MB per Claude Code request (about 240 MB to 1.8 GB in 25 minutes of a busy session), then sat at the admission-guard shed line for 90 minutes with almost no traffic. Retainer path (heap snapshot of a cloned instance after six 420 KB requests, streamed over the inspector): Pool state in the same snapshot: The throw (inspector
Result with this PR applied as a local patch on top of #12542 (rebuilt from source, same Docker path): cloned instance after the same six requests shows Quick bridge for anyone hit by this before the PR lands: setting the compression |
|
This containment fix (spawn-throw queue drain + fail-open observability) is solid and well tested |
|
I validated the ordering against #13637 rather than guessing at it: I replayed this PR on top of How the two intents combine in
The retry-vs-degrade decision moves into Tests follow the merged contract: runtime faults assert a Validation of the reconciled result in a clean
Two gate failures reproduce unchanged on Merge #13637 whenever it's ready and I'll push the rebased version of this PR right after — the resolution is already prepared, so it's a fast turnaround. Happy to invert the order instead if you'd rather land this one first. |
|
Segurando: conflitante com a base e com veredito ⭐3, que precisa de reconfirmação. A PR está conflitante com Sugestão: rebase sobre o tip atual e reconfirmação do veredito. Vale especialmente verificar se o caso que ela ataca — fila do worker pool não drenada quando a construção do worker lança — ainda se reproduz depois da #13423, que mexeu justamente em Se você confirmar que o defeito persiste no tip, com um repro, eu levo para merge. |
Replays cheaper-inference#12755 on top of cheaper-inference#13637 so both fixes survive intact. A synchronous spawn failure left the queue stranded: nothing else calls dispatch() again, so queued jobs and their full request bodies were retained for the lifetime of the process. Queued jobs now reject as retryable when no worker is left to drain them, while a capacity-spawn failure with a healthy worker keeps the backlog for that worker. Preserve cheaper-inference#13637's reject-based runtime-fault contract: fast faults retry compression in-process, while a dispatch timeout degrades to the uncompressed body after spending the worker budget. Keep fail-open reporting, strip non-cloneable callbacks from wire jobs, and guard postMessage failures. Add an end-to-end regression proving the cheaper-inference#13423 shared-subobject shape remains worker-eligible and falls back to in-process compression after synchronous MODULE_NOT_FOUND.
286006e to
656e716
Compare
|
Rebased onto the current tip and reconfirmed the defect post-#13423 (answering your 2026-09-18 review). Rebase. The branch is now a single commit ( Repro that the defect persists after #13423. New e2e regression in
On the unfixed pool the same input strands the queue forever (nothing re-enters Relationship to #13637. This PR only adds the construction-failure layer; the merged runtime-fault contract is preserved: fast faults (spawn throw, worker error/exit, engine throw, Validation
Inherited CI failures (not from this PR). |
da49695
into
cheaper-inference:release/v3.8.51
Summary
Prevents the compression worker pool from retaining queued request bodies when worker construction throws synchronously.
This is deliberately a containment fix: it removes the queue-retention failure mode and makes fail-open behavior observable. Compression still returns the original body when no worker can be created.
Changes
postMessagethrows, and pool shutdown.URLobject to the LLMLingua worker constructor on Node.js 21+.postMessagefailures, queue continuation, and worker respawn.Validation
The release branch is currently red independently of this change.
Tests Added
tests/unit/compression/compression-worker-pool-jam.test.tsCoverage includes structural/transient/unknown spawn failures, populated queue draining, broken-pool short-circuiting, preservation of healthy workers, runtime failures, shutdown settlement, safe handling of unusual thrown values, notifier rate limiting/sanitization, and LLMLingua failure recovery.
Follow-up issues
These root-cause repairs are intentionally separate from this queue-retention containment PR. The runtime must both resolve the worker entry and provide its required packaged dependencies.