fix(zaino-state): replace sleep-ordered mines with handshakes in the mempool-stream tests#1377
Open
zancas wants to merge 3 commits into
Open
fix(zaino-state): replace sleep-ordered mines with handshakes in the mempool-stream tests#1377zancas wants to merge 3 commits into
zancas wants to merge 3 commits into
Conversation
This was referenced Jul 7, 2026
…mempool-stream tests Both mempool-stream mockchain tests spawn a collector task whose stream must open before the main task mines the block that ends the test, and both enforced that ordering with a 500 ms sleep. Under full-suite parallel load the collector can lose the race: the expected-tip variant then arms its stream against the post-mine tip and hangs forever awaiting a second mine, and the no-expected-tip variant collects the drained post-mine mempool and fails its assertion on an empty vector. Both failure modes were observed on loaded machines and neither reproduces solo. Each test now passes a oneshot handshake: the collector signals after get_mempool_stream returns — the point where the stream's termination condition is locked to the pre-mine tip — and the main task awaits that signal before mining. The ordering becomes deterministic, and each test runs about 1.5 s faster by shedding the dead sleep. No fails-before sibling test accompanies the fix: the race window only opens under machine load and cannot be made deterministic in a demonstration. The hangdebug nextest profile that caught the no-expected-tip flake is committed alongside the fix. The default profile deliberately runs the production unit tests with no slow-timeout, so a hung test pends silently and anonymously; a parallel run under this profile names laggards at 60 seconds and terminates a stuck test at 300, dumping its captured output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zancas
force-pushed
the
fix_mempool_stream_test_races
branch
from
July 9, 2026 20:09
43cdd81 to
3c0711f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both mempool-stream mockchain tests ordered "open the stream" before "mine the closing block" with a 500 ms sleep. Under full-suite parallel load the spawned collector can lose that race, and each variant then fails in its own way: the expected-tip variant arms its stream against the post-mine tip and hangs forever awaiting a second mine (observed twice as an indefinite hang of the production suite), while the no-expected-tip variant collects the drained post-mine mempool and fails its assertion on an empty vector (observed once, at 1.8 s, in a parallel run). Neither reproduces solo.
Each test now passes a oneshot handshake: the collector signals after
get_mempool_streamreturns — the point where the stream's termination condition is locked to the pre-mine tip — and the main task awaits that signal before mining. The ordering becomes deterministic and each test sheds the dead sleep, running about 1.5 s faster. Verified with fifty solo iterations across the two variants and three full parallel runs of thezaino-statebinary, all green.The
hangdebugnextest profile that caught the no-expected-tip flake ships alongside the fix. The default profile deliberately runs production unit tests with no slow-timeout, so a hung test pends silently and anonymously;NEXTEST_PROFILE=hangdebug RUST_LOG=trace cargo nextest runnames laggards at 60 seconds and terminates a stuck test at 300, dumping its captured output.🤖 Generated with Claude Code