Cover abortive TCP close in McpServer connection-lifecycle test#223
Merged
Conversation
Add RawClientAbortDropsConnection: opens a raw TCP client with SO_LINGER=(1, 0) so close() emits RST rather than FIN, then asserts connections_active returns to its baseline within 2s. This pairs with the existing FIN-path tests (SilentClose, CloseAfterWrite) to pin both branches of the server-side EOF detection: the graceful FIN -> endStream path and the abortive RST -> transport error path both have to end in the same dispatcher-posted close, or the server leaks accepted connections on a reset.
1a0d742 to
deb8592
Compare
caleb2h
approved these changes
Apr 21, 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
RawClientAbortDropsConnectiontoMcpServerConnectionLifecycleTest, exercising the RST teardown path alongside the existing FIN-based tests.SO_LINGER=(1, 0)viaIoHandle::setSocketOptionsoclose()sends RST instead of FIN — verifies the server's abortive-close handling decrementsconnections_activethe same way a graceful close does.Why
The lifecycle suite already covered graceful FIN teardown; the RST path was exercised only implicitly. After the recent peer-FIN / deferred-close fixes (#221, #222), an explicit RST regression test keeps the abortive branch honest against future refactors.
Test plan
ctest -R McpServerConnectionLifecycleTest—RawClientAbortDropsConnectionpasses in ~270ms alongside existing tests.