Repository navigation
DO NOT MERGE without coordinator GO: 3.x.x: drop an idle node connection after 20 s, below qbitd's 30 s idle close (#759) - #760
Merged
Conversation
…le close, and send each relay call on a new connection (#759) The frontends' qbitd RPC client kept an idle keep-alive connection for 60 seconds, while qbitd closes one after its -rpcservertimeout, 30 seconds by default. A request written into a connection just as the node closes it is never read, and fails after the connection existed. That is the plain "transport failed" error, which nothing retries. On submitblock it is an unknown outcome, and the block is never offered again. A production deployment logs that error from the CTV broadcaster on about one pass in eight to fifteen, which fits this race: the broadcaster's 30 second interval runs in step with the 2 second refresh interval. The client now keeps an idle connection for at most 20 seconds (POOL_IDLE_TIMEOUT), so it drops one before the node can close it. A compile-time assert keeps the bound below QBITD_DEFAULT_RPCSERVERTIMEOUT. node_client_builder() carries the bound, and the public API's node client and the load harness's node clients are built from it. Rpc::with_pool_idle_timeout sets another bound, for a node with a shorter idle close and for tests. Every RELAY_METHODS call now goes through a second client that keeps no idle connection, so each relay opens a new one. A relay can then fail only to connect, which is provably unsent, or on the connection it just opened, which is a genuine unknown rather than this race. A node with a shorter idle close than the bound, or a proxy that drops idle connections, can no longer race a relay. A relay is rare, and the new connection costs one connect. tests/rpc_idle_close.rs runs the real client against a loopback node that drops a request arriving after its idle limit, as the race does, and counts the connections it accepts. With a shorter bound, the next call opens a new connection and is answered. With the old long bound, it reuses the stale one and fails with the production error, which is not RpcNotSentError. A relay call after the pause is answered on a new connection even with the long bound. The migration guide notes the node-side requirement. 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. |
…rom node_client_builder (review on #760) A new connection for each relay put its connect inside submitblock's 1 second deadline (PRISM_BLOCK_SUBMIT_RPC_TIMEOUT_SECONDS). A deadline that passes while connecting is a timeout, not a connect error, so the block would count as an unknown offer and never be offered again: a lost SYN or a slow accept would cost a block that never reached the node. A warm pooled connection within the 20 second bound is the safer path, so relays share it again, as they did before this PR. Rpc's client now starts from node_client_builder(), like the public API's and the load harness's. The pool_idle_timeout accessor and its test only restated the constant, so they are gone. The docs name a proxy's idle timeout beside qbitd's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 10, 2026
RobertClarke
added a commit
that referenced
this pull request
Oct 19, 2026
The notes cover everything since v3.0.0-rc.6: #770's import-audits fix (#765) and #760's idle-connection bound (#759), which would have shipped as rc.7, and the 3.1 dual writer (#766, #768, #767, #769, #763), off by default. They describe the new settings, migrations 027, 028 and 031 (029 and 030 reserved), the upgrade from rc.6 with the migrate run while rc.6 serves, the rollbacks, and the dual writer's known limits. The migration guide's import-audits paragraph names this candidate in place of the skipped rc.7. Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke
added a commit
that referenced
this pull request
Oct 20, 2026
* 3.x.x: version 3.1.0-rc.1 VERSION, the workspace version and both lockfiles move to 3.1.0-rc.1. The fuzz lockfile also picks up hyper and hyper-util, which #769 added to the server without refreshing it. The 3.0.0 and development-line notes point at the new candidate; its own notes follow in this pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 release notes The notes cover everything since v3.0.0-rc.6: #770's import-audits fix (#765) and #760's idle-connection bound (#759), which would have shipped as rc.7, and the 3.1 dual writer (#766, #768, #767, #769, #763), off by default. They describe the new settings, migrations 027, 028 and 031 (029 and 030 reserved), the upgrade from rc.6 with the migrate run while rc.6 serves, the rollbacks, and the dual writer's known limits. The migration guide's import-audits paragraph names this candidate in place of the skipped rc.7. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 notes: #773's pre-migrate tests Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 notes: the rollback to one writer stops and syncs the peer first Codex on #774: DOWNGRADE fences nothing, so the peer must be stopped, and its tail pulled, before the single-writer start; declare the tail lost only for a peer that never returns with its own database. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
3 of 6 tasks
kiwidream
added a commit
that referenced
this pull request
Oct 22, 2026
* 3.0.x: version 3.0.0 and its release notes (#557) 3.0.0 is 3.0.0-rc.6 plus #770 (#765) and #760 (#759), the two fixes #772 prepared as 3.0.0-rc.7, which was never tagged. The 3.0.x branch starts at #770's merge, 4c13491, before 3.x.x took the 3.1 dual writer. - VERSION, [workspace.package].version and the workspace-member entries of both Cargo.lock files move to 3.0.0. - doc/release-notes-3.0.0.md becomes the 3.0.0 notes: #772's rc.7 notes as the changes since rc.6, then the D5 recovery contract it held. - The development-line note and the migration guide name 3.0.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.0.x: update rustls, rustls-webpki and webpki-roots for six RustSec advisories cargo deny fails on rc.6's lockfile with RUSTSEC-2026-0346, -0347, -0348 and -0349 (rustls < 0.23.46), RUSTSEC-2026-0382 (rustls-webpki < 0.103.16) and RUSTSEC-2026-0381 (webpki-roots < 1.0.10). Move each to its first fixed patch release with cargo update --precise, in the root and fuzz lockfiles, as #354 did for RUSTSEC-2026-0285. No other dependency changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.0.x: describe 3.0.0 as this line's production release The development-line note's status, not-done and upgrade sections, and the README banner, said no production release of the Rust server existed. With the coordinator's go-ahead for 3.0.0 they now point to 3.0.0 on 3.0.x and its notes, and say 3.x.x continues as 3.1. The 3.0.0 notes list the TLS dependency update. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 22, 2026
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.
Part of #759. Product code (the frontends' node RPC client): DO NOT MERGE without the coordinator's GO.
The problem
The frontends' qbitd RPC client (
rpc.rs) kept an idle keep-alive connection for 60 s. qbitd closes one after its-rpcservertimeout, 30 s by default.qbit RPC <method> transport failed, and nothing retries it.submitblock,classify_offerrecords that failure asOfferOutcome::Unknown, and an unknown offer is never offered again. The race is rare at random block times, but each hit costs a block.The change
rpc.rs:POOL_IDLE_TIMEOUT = 20 s, belowQBITD_DEFAULT_RPCSERVERTIMEOUT(30 s); aconstassert keeps it there.Rpc::newuses it.Rpc::with_pool_idle_timeoutsets another bound: for a node configured with a shorter idle close, and for tests.node_client_builder()carries the bound. Every node client starts from it:Rpc's, the public API's and the load harness's.api.rs: the public API's node client takes the bound. It took reqwest's 90 s default.docs/prism-rust-migration.md: keep qbitd's-rpcservertimeout, and any proxy's idle timeout in front of the node, above 20 s. The default 30 s is fine, and a raised value, such as 120, is fine too.Relay calls stay on the bounded pool, deliberately. The first head sent each
RELAY_METHODScall on a new connection. Review found the cost: the connect then sits insidesubmitblock's 1 s deadline (PRISM_BLOCK_SUBMIT_RPC_TIMEOUT_SECONDS).RpcNotSentError.Not in this PR (left open on #759):
Rpc::with_pool_idle_timeout.live_pg_failover's node gate,live_regtest's fixture client andlive_session_load's block watcher. They're test-only, so a follow-up moves them tonode_client_builder()rather than restarting this PR's CI.submitblockconnects within its 1 s deadline. A deadline that passes during that connect is recorded as unknown, not unsent. A connect deadline below the call's deadline, or a check that the connection never opened, would keep that case provably unsent.Tests
tests/rpc_idle_close.rsruns the real client against a loopback node, which counts the connections it accepts. The node answers a request on a reused connection only within its idle limit (400 ms); a later one is read and dropped unanswered, as in the race.a_call_after_the_nodes_idle_close_uses_a_new_connection: with a 200 ms bound and a 700 ms pause, the second call opens a second connection and gets its answer.a_connection_kept_past_the_nodes_idle_close_fails_the_call: with the old 60 s bound, the second call reuses the stale connection (one connection in all) and fails withqbit RPC getblockcount transport failed. It is notRpcNotSentError. This proves the mock reproduces the production failure, and that the bound is what prevents it.Local results at this head (
65d26922):cargo fmt --checkandcargo clippy --locked --workspace --all-targets -- -D warningsare clean.cargo test --locked -p qbit-prism-server -p qbit-prism-load: 113 test binaries, 0 failures. The PostgreSQL-gated tests skipped locally (no database), so CI's PostgreSQL shards are their run.rpc_idle_closerepeated 40 times at the first head: 40 of 40 green. Both remaining cases are unchanged since then.🤖 Generated with Claude Code