You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_two_adopters_racing_on_stranded_debris_produce_one_winner failed on main — two adopters cleared the same stranded marker and both took the lock #291
test_two_adopters_racing_on_stranded_debris_produce_one_winner failed on main — two adopters cleared the same stranded marker and both took the lock
The failure
main at 6d19ff7, run 30710401042, leg pytest (ubuntu-latest, 3.11) — one leg of twelve, the other eleven green:
> assert not doubled, (
E AssertionError: rounds with more than one winner: {'24': 2} — two adopters cleared the same stranded marker and both took the lock
E assert not {'24': 2}
tests/test_lock_primitive.py:565: AssertionError
============ 1 failed, 1323 passed, 6 skipped in 345.20s (0:05:45) =============
Round 24 of the loop produced two winners where the invariant is exactly one.
What it is not
Worth stating, because the obvious suspect is innocent. The commit is the squash of #290 (dispatch timeouts, #286), and that PR was 12/12 green on its own run immediately before. It changed scripts/log.sh, config.example.json, README.md, CHANGELOG.md and added tests/test_dispatch_timeout_286.py.
The lock primitive lives in scripts/lib-lock.sh, which the merge does not touch — the only lock matches in the merge are prose in its own commit message. So the code under test is unchanged from the eleven green runs before it, and this is not a regression from that merge. Different commit, different scheduling, same code.
Why it is filed rather than re-run away
1 failed, 1323 passed is the useful shape: the suite was not disarmed, one race lost. And the assertion is not a proxy — it is the invariant the file exists to defend, stated in the test's own words.
Two readings, and I am not ranking them:
The test is racy. It drives real concurrent adopters and asserts on a scheduling outcome; a loaded two-core runner is exactly where that goes wrong without the product being wrong.
The lock is racy. Two adopters clearing the same stranded marker and both proceeding is a real interleaving, not an artefact — and if it can happen on a runner it can happen on a laptop under load. A lock that admits two writers to a memory store is not a cosmetic defect.
The reason to file rather than re-run: this is the second sighting of a lock-ownership concurrency failure on a single ubuntu leg of main. The first cleared on a re-run and left nothing behind, which is exactly why it cost a second investigation. Re-running is cheap and buries the evidence; the log above is now the record whether or not the next run is green.
Recent history, for calibration
Twelve most recent main runs: this one failed, the eleven before it succeeded. So it is not chronic — it is rare, which is the property that makes each occurrence worth keeping.
What would settle it
Run the stranded-adoption loop under taskset/CPU contention locally and see whether it reproduces at a rate that a two-core runner would hit.
Read the adoption path for the window between "clear the stranded marker" and "take the lock" — if those are not a single atomic step, the second reading is confirmed and the test is doing its job.
If the test is genuinely racy rather than the lock, the fix is not a longer sleep; it is asserting the invariant in a way that does not depend on the scheduler.
Activity
fix(tests): assert the adopt race on _lock_try_adopt, not on lock_acq…