Repository navigation
3.x.x: bound the failover test's share and subscribe waits by the server's own answer bounds (#562) - #572
Merged
Conversation
…ver's own answer bounds (#562) real_two_server_mining_failover_audit_and_reorg waited a fixed 20 s for three newly credited shares on the surviving server after the other is killed, and again on the restarted server. Every regtest share is also a block. A proof on work whose payout revision a landing superseded is captured (#478), and its answer waits for that server's own landing of the block, up to block_only_ack_timeout (max(share_commit_timeout, 60 s), 60 s here). Under host load a landing takes seconds, so three credited shares outlasted 20 s. Both waits now allow 20 s plus three full answer bounds. The shares required and the counts compared are unchanged. The fixture's subscribe read deadline was a fixed 5 s, but the server bounds session allocation by initial_job_timeout_seconds (30 s by default); it now waits 35 s. A killed peer's own claims do not stall the survivor: with server 0 killed while its block was offered (its row left claimed for 120 s), the survivor credited three shares within 1.2 s. Its captured proofs answered in about 200 ms. Test-only. Closes #562. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
Review ledger (#562)This PR changes tests only, so under the current policy it got a proportionate check rather than a full deep review: one Review findings
The review also checked the following and found them sound:
Follow-upThe product question, whether a captured proof's acknowledgement should wait for its landing at all, is drafted as a separate issue for the #478 owner. CIAll required checks green on the PR head (0c8b9b1, rebased cleanly onto 3.x.x after #563 merged; hunks unchanged, clippy and fmt re-run clean). |
This was referenced Sep 29, 2026
8 of 10 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.
Makes
live_regtest::real_two_server_mining_failover_audit_and_reorgwait for its shares by the server's own answer bound instead of a fixed 20 s. Test-only: the counts compared and the shares required are unchanged.Cause
After server 0 is killed, the test waits a fixed 20 s for three newly credited shares on server 1. It waits the same way on the restarted server 0. Every regtest share is also a block. A block proof on work whose payout revision a landing superseded is captured (#478) and takes the block-only path with its share deferred. Its Stratum answer waits for that server's own landing of the block, up to
block_only_ack_timeout:max(share_commit_timeout, 60 s), which is 60 s here. The miner answers each submission in turn, so a slow landing holds everything behind it. Under host-wide load (load average 30–50), landings took seconds each, and three credited shares outlasted 20 s. That was 4 of 63 runs, all withtimed out waiting for surviving server mining.What it is not: the killed peer's own leftovers. The runs below used a one-shot trigger to hold server 0's
offered→ landed transition, then killed server 0 mid-landing (its row staysofferedunder its 120 s claim). In all 3 runs the survivor still credited three shares within 1.2 s, and its captured proofs answered in about 200 ms.Fix
20 + 3 × block_only_ack_seconds(200 s): each of the three shares may use its whole answer bound. A healthy run still finishes in about 1 s, because the wait returns as soon as the count is reached.subscription()'s read deadline goes from 5 s to 35 s, because the server bounds session allocation byinitial_job_timeout_seconds(30 s by default).Evidence
All runs pin the test binary, qbitd, both servers and the private PostgreSQL 16 (fsync on) to the same two cores.
offer_reservedtransition after the kill held 25 s by a triggertimed out waiting for surviving server miningquiesce)timed out waiting for surviving server miningCaveat on the injected runs after the fix. Some later failed further on, at a different step. The injection sleeps inside a live transaction, and server 0's restart queues behind the locks that transaction still holds, so its startup statements and the test's own reads hit
lock_timeout. That is an artifact of holding a 25 s transaction, not the condition this PR addresses.Delay chosen. An 8 s landing delay did not fail the old test: the survivor needed 16.6 s against 20 s. A delay inside the landing's own transaction also trades waits for 5 s lock timeouts. 25 s at
offer_reservedis the smallest placement that failed the old test every time.Follow-up
Whether a captured block proof's answer should wait for its landing at all is a product question; a follow-up issue has been drafted for the #478 owner. This PR only makes the test honour the current bound.
CI runtime
None in a healthy run: each wait returns as soon as its condition holds.
Checks
cargo clippy --locked -p qbit-prism-server --test live_regtest -- -D warnings: clean.cargo fmt --all --check: clean.test/prism-gated-tests.txtis unchanged, because no test id changed.Closes #562
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.