Skip to content

net: tear down peer session when writer dies (mempool_reorg flake) - #307

Merged
reardencode merged 1 commit into
masterfrom
net/disconnect-far-eof
Aug 30, 2026
Merged

net: tear down peer session when writer dies (mempool_reorg flake)#307
reardencode merged 1 commit into
masterfrom
net/disconnect-far-eof

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Core-functional attempt 1 of run 33310407181 failed mempool_reorg.py on the same far-side disconnect_nodes 5s getpeerinfo wait, even with #304’s Shutdown::Both on the tree.

Fix:

  • select! on writer-task completion so a half-close / write error tears the session down (and unregister runs) without waiting on a stuck read/decode arm.
  • Treat any NetError::Io on read as clean peer-gone.
  • Map BIP324 ConnectionAborted (+ RetryV1) to NetError::Io like the other hard-close kinds.
  • Stress pin: generate 3 blocks, sync, disconnect — far side clears within 5s.

Test plan

  • disconnect_after_tip_sync_clears_far_side_within_5s
  • disconnect_clears_far_side_getpeerinfo_within_5s
  • disconnect_id_shuts_down_tcp_so_far_side_sees_eof
  • CI + core-functional (label)

After tip sync, disconnect_nodes still flaked waiting for the far side's
getpeerinfo: a write failure or BIP324 close mapped oddly could leave the
session in getpeerinfo past 5s. Select on writer-task completion, treat any
socket Io as a clean peer-gone exit, and map ConnectionAborted through as Io.
@rearden-grok rearden-grok Bot added the core-functional Run Core functional nightly.sh on this PR (inventory + release-pin warn) label Aug 30, 2026
@reardencode
reardencode merged commit 1a19873 into master Aug 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-functional Run Core functional nightly.sh on this PR (inventory + release-pin warn)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant