Skip to content

3.x.x: make the block-only poll acquire tests deterministic on slow runners - #804

Merged
kiwidream merged 1 commit into
3.x.xfrom
orca/acquire-tests-flake
Oct 28, 2026
Merged

kiwidream merged 1 commit into
3.x.xfrom
orca/acquire-tests-flake

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

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 biased select! that takes the slot (in first_poll, and in the drain for the missing and SQL-error cases) polled the pool acquire before persist. 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 before persist had taken the poll's answer. persist then started its 50 ms sleep only after pause() and advance(50ms), and never spawned the next poll.

Fix (one test file; every assertion unchanged)

  • Poll persist before the slot in both selects. On the current-thread runtime the poll task completes before its connection can return, so persist is always asleep on the answer when the test holds the slot.
  • wait_counts now 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_unknown missing_and_sql_error_stay_unknown
Before failed 1/20 failed 3/20
After passed 20/20 (all four block_only_poll tests) passed 20/20

Forcing the bad schedule unpinned failed the first test 2 of 3 runs before the fix. The whole acquire_tests module passes 10/10 pinned and unpinned, and fmt, clippy and the guards pass.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T18:28:19.033870Z 91b42c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qbit-reviewer qbit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings.

@kiwidream
kiwidream merged commit dc2a2cc into 3.x.x Oct 28, 2026
41 checks passed
@kiwidream kiwidream mentioned this pull request Oct 28, 2026
1 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant