flaky-test: recovery_b1_adversarial_unittest.py wait_ready() TOCTOU race → ECONNREFUSED under CI load #897
Reference in New Issue
Block a user
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?
The framework-shell
teststep intermittently fails withConnectionRefusedError: [Errno 111]inpackages/mosaic/src/lease-broker/recovery_b1_adversarial_unittest.py.Root cause (from source):
setUp()spawns the lease-broker daemon andwait_ready()polls only for the unix-socket FILE to exist (socket_path.exists()), NOT for the daemon to reachlisten(). Under concurrent-pipeline runner load the socket file appears beforelisten()→ immediate clientconnect()gets ECONNREFUSED.Evidence: origin/main pipeline 2005
test=SUCCESS (1508/1508); PR pipelines 2006/2010/2011 (#893/#894/#895) failedtestwith vitest still 1508/1508 — only this Python setUp raced; #894 was a trivial 1-line change. Green on main + red on trivial PRs under 4-pipeline load = flaky race, not a defect. OBe945bf77.Fix (scalpel scope, Mos-ruled): change ONLY
wait_ready()— replace file-existence polling with a realconnect()retry loop + timeout. NO daemon code, NO assertion changes, NO gate-timeout relaxation (this is the #828/#869 test-locked fail-closed area). Independent review MUST verify every assertion in the recovery suite is byte-unchanged.