R17
What to build¶
Open-loop serving terminates owned cooperative workers without waiting on stop markers that have no readers.
Source and evidence¶
Repository scientific/architectural review, snapshot 86c8517, item R17.
Classification: confirmed defect; high severity.
After the drain deadline, workers are cancelled, but the finally block queues
one stop marker per original worker before gathering them. The workers can exit
without consuming those markers. When queue capacity is smaller than worker
count, putting further markers waits forever on a full queue. Caller cancellation
also enters this cleanup without cancelling the workers: a cooperating client
waiting indefinitely receives no cancellation, and the coordinator waits for it.
The configured drain deadline does not bound either cleanup path.
The retained serving cleanup probe uses an ordinary cancellable async client, two workers and queue capacity one. The arrival window is 2ms. With a zero drain deadline, the run remains unfinished after 100ms even though all children have exited. In a separate run, cancelling the coordinator after the client enters leaves the run unfinished after 100ms and one child alive. The experiment independently cancels and gathers all remaining tasks after each observation. These are observed stalls plus a control-flow explanation, not a claim that a cancellation-resistant client can be forcibly terminated.
Acceptance criteria¶
- [ ] Two workers with queue capacity one and zero drain budget return a terminal result within the documented cleanup grace.
- [ ] Caller cancellation during production and drain cancels and joins owned cooperative client work, then propagates cancellation.
- [ ] Injected clock/sleep/client failures trigger the same cleanup ownership without orphan tasks.
- [ ] Normal completion still drains correctly and scheduled/admitted/sent/completed/drop accounting conserves arrivals.
- [ ] Preserve Consumer-owned meaning, payload-free evidence, disabled optional-import isolation, safe diagnostics and the non-relaxable Safety Floor.
- [ ] Run the narrowest observable contract, then applicable committed Make gates. Record every command and outcome; update specifications/compatibility evidence for changed public or wire contracts. Run native Collector verification for changed Collector assets and build for packaging changes.
Design guidance¶
Separate normal stop-marker delivery from exceptional cancellation. Cancel and await owned workers directly on deadline/error; never await a put into a queue whose readers have exited. Do not promise forced termination of cancellation-resistant Consumer code.
Keep prefactoring narrow and verifiable in this slice. Reuse established owners and structural interfaces; introduce a pattern only when it clarifies a real responsibility or variation point. Do not add consumer vocabulary or private payloads to platform code or evidence. Mocked/local results must not claim hosted, production, accelerator or release qualification.
Blocked by¶
None (can start immediately). Shared-area coordination is useful, but no other review fix is a genuine prerequisite for this slice.
Verification scope¶
Convert the described counterexample or investigation oracle into an observable test at the lowest suitable public boundary. Prefer bounded operation-count or deterministic interleaving evidence to flaky timing assertions; timing guarantees need a declared tolerance and independently owned cleanup. This ticket authorizes remediation/research, not publication or deployment.