Repository navigation
rpc: recover capacity from stalled connections - #1240
Open
niteshbalusu11 wants to merge 2 commits into
Open
niteshbalusu11 wants to merge 2 commits into
niteshbalusu11 wants to merge 2 commits into
Conversation
Bound HTTP header and body reads to 30 seconds so idle TCP and Unix clients release the shared connection cap. Preserve complete long-poll requests and verify recovery through the socket journeys.
niteshbalusu11
force-pushed
the
rpc/expire-stalled-connections
branch
from
October 27, 2026 18:57
4bdfe0f to
cc27292
Compare
Detach connection tasks and signal Hyper graceful shutdown when the accept task exits. Keep shutdown independent of long-poll deadlines, close idle sockets, and retain the body read deadline while requests drain.
Contributor
There was a problem hiding this comment.
APPROVE
The shutdown finding is fixed. Connection tasks are detached from the accept task, and dropping the watch sender when that task exits calls graceful_shutdown on the hyper connection and still awaits it. RpcHandle::shutdown does not wait on those tasks. long_poll_does_not_hold_the_work_queue returns from listener shutdown within 500ms, sees the idle socket close, and then reads the in-flight waitfornewblock body.
No new bugs. The rbitcoin-rpc server binary finished in 1.77s on this head versus 3.13s on master 5cc40ff0. The added waits are paused-time advances and 500ms guards.
0 bugs, 0 suggestions, 0 nits.
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.
Opening 256 idle RPC connections could block every TCP and Unix-socket client indefinitely. Headers, request bodies, and idle keep-alive connections now expire after 30 seconds and release their slots. Complete RPC calls retain their existing execution deadlines, and in-flight replies finish gracefully when the listener stops.
Fixes #1237.
Proved with failing-then-passing socket regressions for connection expiry and shutdown replies. On a live regtest node, all 256 idle sockets closed and both listeners recovered within 31 seconds; incomplete requests expired; a 35-second long-poll returned successfully. Eight shutdown runs returned all eight stop replies and 64 waiting RPC replies.
Validation: workspace tests, formatting, Clippy, cargo-deny, ast-grep, unwrap ratchet, and OS smoke passed. Local tests used four test threads and two Tokio workers with the runner's artificial address-space cap disabled after resource exhaustion in unrelated tests.
Reviewed with sol-loop: 2 rounds with gpt-6.1-sol on high. Sol verdict: approved.
Created with GPT-6 Astra in Codex (T3 Code).