fix disconnect event in tcp connector#86
Merged
Merged
Conversation
BrycePy
approved these changes
Jun 5, 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.
Summary
Fix TCP disconnect reporting for connections that are dropped outside read-side event handling.
Issue
TcpConnectoronly emittedPollEvent::Disconnectwhen a connection was found dead while processing amioevent. Connections can also be dropped during send-side work:Those paths removed the connection from
ConnectionManagerinternally, but the caller never received a disconnect event. Callers that maintain their own token-to-peer state could then keep stale connection state forever.Root Cause
disconnect_at_indexwas called directly from write/backlog paths without notifying the application. Only read-side polling called the user's handler withPollEvent::Disconnect.Accepted inbound sockets also did not get
TCP_USER_TIMEOUT, while outbound sockets did. That made unclean inbound connection loss slower to detect under network failure.Fix
ConnectionManager.poll_withandpoll_with_produce, so callers receive the samePollEvent::Disconnectregardless of where the dead socket was detected.TCP_USER_TIMEOUTto accepted inbound sockets as well as outbound sockets.This preserves the existing public API while fixing the event stream seen by callers.
Validation
backlog_disconnect_is_reported, which forces a backlog-triggered disconnect and asserts thatPollEvent::Disconnectis emitted for the accepted stream token.cargo test -p flux-network.cargo clippy -p flux-network --all-targets -- -D warnings.git diff --check.