Flaky under load: test_scenario_11 client-disconnect cancel can assert before the cancel reaches the worker reader #143
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
P1
P2
P3
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/scarcity-router#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Discovered during program #132 full-gate runs on
compat/logical-model-resolution(child B, #134); the failing path is untouched by that branch's diff, and the class passes 8/8 in isolation on BOTH the branch and pristinedevelop@893d2cb— evidence points to a pre-existing, load-sensitive race.Evidence (2026-09-26 session)
make check: 2 failures of ~7 runs this session, alwaystest_e2e_execution.CancellationTests.test_scenario_11_client_disconnect_propagates_cancel—
AssertionError: [] is not true : cancel never reached the worker(tests/test_e2e_execution.py:875).develop— the race only manifests under full-suite system load.Root-cause hypothesis (not verified)
In
test_scenario_11_client_disconnect_propagates_cancel, after the client half-closes (SHUT_WR) the test drains the response socket:Under load the server's FIN can be observed (EOF →
break) before the cancel message has been read and recorded by the worker's reader thread (worker.cancelsis populated bystart_reader()), so the assertion races cancel delivery against FIN observation. The 15 s deadline never gets a chance to protect the assertion because a clean EOF exits the loop early.Fix direction (root cause, no retries, no timeout bumps)
Reconcile the two exit conditions: on EOF, keep polling
worker.cancelsfor a short bounded grace window (the cancel is expected to be in flight at that point), or wait on the worker reader's cancel-received event instead of inferring from socket EOF. The wait must remain deterministic and bounded.Non-goals
No product behavior change is implied by the evidence; do not weaken the scenario's assertion (cancel propagation to the exact owning worker is the property under test).
Second variant of the same load-sensitive race family, observed 2026-09-28 during the D-057 / PR #149 full-gate runs on
contract/reasoning-effort-serialization(head2ffc224, based ondevelop@f574e51):make check: 1 failure of 2 runs this session —test_e2e_execution.CancellationTests.test_scenario_11_cancel_reaches_exactly_the_owning_worker(tests/test_e2e_execution.py:906):AssertionError: [] is not true(worker.cancelsempty — cancel not yet recorded when asserted).develop@f574e51— same shape as the originally reported scenario: the assertion races cancel delivery against an earlier exit condition, manifesting only under full-suite system load. The failing path is untouched by the #149 diff (candidate-serialization change only).