Skip to content

Commit 490569d

Browse files
fix(producer): address review nits on worker-pool crash recovery
- Reword the dead-marking comments in both onWorkerError handlers: the flag is set before rejecting and before draining the queue, not "before anything else" (current/busy are cleared first). - Rename the shader pool's all-slots-die test to match the png pool's equivalent; the size-2 fixture crashes every worker, so there are no surviving workers serving.
1 parent feed993 commit 490569d

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎packages/producer/src/services/pngDecodeBlitWorkerPool.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ export async function createPngDecodeBlitWorkerPool(
365365
const task = slot.current;
366366
slot.current = null;
367367
slot.busy = false;
368-
// Mark dead BEFORE anything else so this slot is excluded from future
369-
// dispatch; postMessage to its terminated worker would be a silent no-op
370-
// and any task routed here would hang.
368+
// Mark dead before rejecting and before draining the queue so this slot is
369+
// excluded from future dispatch; postMessage to its terminated worker would
370+
// be a silent no-op and any task routed here would hang.
371371
slot.dead = true;
372372
if (task) {
373373
task.reject(

‎packages/producer/src/services/shaderTransitionWorkerPool.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ describe("ShaderTransitionWorkerPool", () => {
374374
expect(await queued).toBe("rejected");
375375
});
376376

377-
it("keeps serving on surviving workers after one slot dies", async () => {
378-
// Size 2: both slots run the crashing fixture, so a real blend can't be
379-
// asserted here, but the pool must not wedge — every run settles.
377+
it("never wedges the pool when all slots die", async () => {
378+
// Size 2: both slots run the crashing fixture, so there are no surviving
379+
// workers; the pool must still never wedge — every run settles.
380380
const pool = await makeCrashPool(2);
381381
const results = await Promise.all([
382382
settledWithin(pool.run(blendReq())),

‎packages/producer/src/services/shaderTransitionWorkerPool.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,10 @@ export async function createShaderTransitionWorkerPool(
308308
const task = slot.current;
309309
slot.current = null;
310310
slot.busy = false;
311-
// Mark dead BEFORE anything else: this slot's worker can no longer accept
312-
// a dispatch (postMessage would be a silent no-op), so it must be excluded
313-
// from future slot selection or a later task would hang on it.
311+
// Mark dead before rejecting and before draining the queue: this slot's
312+
// worker can no longer accept a dispatch (postMessage would be a silent
313+
// no-op), so it must be excluded from future slot selection or a later
314+
// task would hang on it.
314315
slot.dead = true;
315316
if (task) {
316317
// The in-flight task's buffers were transferred to the worker. They're

0 commit comments

Comments
 (0)