Skip to content

Cover abortive TCP close in McpServer connection-lifecycle test#223

Merged
gophergogo merged 1 commit into
mainfrom
test/raw-client-abort-integration-coverage
Apr 21, 2026
Merged

Cover abortive TCP close in McpServer connection-lifecycle test#223
gophergogo merged 1 commit into
mainfrom
test/raw-client-abort-integration-coverage

Conversation

@gophergogo
Copy link
Copy Markdown
Collaborator

Summary

  • Adds RawClientAbortDropsConnection to McpServerConnectionLifecycleTest, exercising the RST teardown path alongside the existing FIN-based tests.
  • Client uses SO_LINGER=(1, 0) via IoHandle::setSocketOption so close() sends RST instead of FIN — verifies the server's abortive-close handling decrements connections_active the 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 McpServerConnectionLifecycleTestRawClientAbortDropsConnection passes in ~270ms alongside existing tests.
  • Full lifecycle suite green.

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.
@gophergogo gophergogo force-pushed the test/raw-client-abort-integration-coverage branch from 1a0d742 to deb8592 Compare April 21, 2026 05:08
@gophergogo gophergogo merged commit bbda1bd into main Apr 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants