net: make disconnectnode clear peers promptly (mempool_reorg flake) - #304
Merged
Conversation
disconnect_id now clears the writer channel, aborts the writer task (TCP FIN to the peer), and unregisters immediately so getpeerinfo drops the row without waiting for the session loop. Fixes flaky mempool_reorg disconnect_nodes (5s far-side wait). Also treat ConnectionReset/BrokenPipe/Aborted as clean peer close.
added 2 commits
August 29, 2026 09:34
Writer abort alone was not enough for mempool_reorg's far-side getpeerinfo wait. Attach a session AbortHandle and abort it on disconnect_id so reader+writer drop immediately (TCP RST/FIN).
ast-grep detached-tokio-spawn rejected the oneshot helper tasks that installed set_session_abort. Pass the AbortHandle into the session task instead so disconnectnode still aborts the whole session.
rearden-grok
Bot
force-pushed
the
net/disconnect-peer-prompt
branch
from
August 29, 2026 16:36
c0b18a0 to
11a9b2d
Compare
mempool_reorg disconnect_nodes still flaked waiting for the far side's getpeerinfo: aborting our session was not enough when the peer was mid-frame. Clone the std TCP fd at open_v2 and Shutdown::Both on disconnect_id so the far read sees EOF inside the 5s wait.
4 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.
Summary
Nightly core-functional attempt 1 of run 33253285378 failed on
mempool_reorg.py:disconnect_nodestimed out (5s) waiting for the far side to drop the peer fromgetpeerinfo.disconnectnodeonly set a stop flag; TCP FIN / far-side EOF could wait on our session loop, and localgetpeerinfokept the row until teardown.Fix:
disconnect_id,Shutdown::Bothon a cloned std TCP fd (fromopen_v2), abort writer + session tasks, unregister immediately.AbortHandlevia oneshot (no detachedtokio::spawn).Test plan
disconnect_id_shuts_down_tcp_so_far_side_sees_eofdisconnect_clears_far_side_getpeerinfo_within_5speerhub_register_snapshot_disconnect./scripts/ast-grep.shcore-functional