Repository navigation
3.x.x: make the block-only poll acquire tests deterministic on slow runners - #804
Merged
Merged
Conversation
…unners block_only_poll_checkout_cancel_and_deadline_stay_unknown and block_only_poll_missing_and_sql_error_stay_unknown failed intermittently in CI shard 1 with "checkout boundary not reached: deadline has elapsed": the last wait_counts, for the poll the test expects to be queued behind its held slot, never saw that checkout. Both tests take the sole slot in a biased select that polled the slot first and the submission second. When the poll task's connection return ping and the test's own checkout ping both completed in one wake (a loaded runner, or PostgreSQL sharing the test's CPU), the select returned the slot before the submission had taken the poll's answer. The submission then started its 50 ms sleep only at the test's next poll, after tokio::time::pause() and advance(50 ms), so it never spawned the next poll: dropped (case 1) or past its bound (case 2 and the missing / SQL-error cases), it answered as asserted and left no checkout to count. Poll the submission before the slot in first_poll and in the missing / SQL-error drain. Its poll task finishes before that task's connection can return, so the submission is always asleep on the answer by the time the test holds the slot; every assertion is unchanged. wait_counts now names the awaiting line and the counts it saw when it times out. Under taskset -c 0, 20 runs each: before, checkout_cancel failed 1/20 and missing_and_sql 3/20; after, both (and the other block_only_poll tests) pass 20/20. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
1 of 5 tasks
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.
Fixes the CI flake in
coordinator::miner_submit::acquire_tests::block_only_poll_*, which failed shard 1 in runs 40565379439 (#792), 40726088437 (#794), 40734915026 (#795) and 40726591893 (3.x.x's own push CI after #793).Cause (test-side, not a product bug)
Each failure was a hidden "checkout boundary not reached / deadline has elapsed" from the final
wait_counts, waiting for the poll the test expects to queue behind its held slot. The biasedselect!that takes the slot (infirst_poll, and in the drain for the missing and SQL-error cases) polled the pool acquire beforepersist. When the poll's return ping and the test's checkout ping finished in one wake (a loaded runner, or PostgreSQL on the same CPU), the test held the slot beforepersisthad taken the poll's answer.persistthen started its 50 ms sleep only afterpause()andadvance(50ms), and never spawned the next poll.Fix (one test file; every assertion unchanged)
persistbefore the slot in both selects. On the current-thread runtime the poll task completes before its connection can return, sopersistis always asleep on the answer when the test holds the slot.wait_countsnow reports its call site and the counts it saw when it times out.Evidence
Pinned to one CPU (
taskset -c 0, about CI's 2-vCPU timing):checkout_cancel_and_deadline_stay_unknownmissing_and_sql_error_stay_unknownblock_only_polltests)Forcing the bad schedule unpinned failed the first test 2 of 3 runs before the fix. The whole
acquire_testsmodule passes 10/10 pinned and unpinned, and fmt, clippy and the guards pass.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.