Repository navigation
test(realtime): close pending TCP sockets during handshake cleanup - #19
Merged
Merged
Conversation
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 the Realtime handshake-timeout test server cleanup so it closes every accepted TCP socket, including connections that have not reached HTTP Upgrade. Add a regression that opens a TCP connection without sending an upgrade request and verifies that cleanup completes and closes the peer.
Why
When the 15 ms handshake deadline expires before the server processes the upgrade, the previous cleanup misses the socket and waits indefinitely for
server.close(). Node then cancels the test and subsequent cases with “Promise resolution is still pending but the event loop has already resolved”. Keep the existing timeout and error-type assertion intact.Verification
npm run buildnpm run typechecknpm testnpm run docs:checkCommands and results (Node v22.22.2):
Impact
CHANGELOG.mdunderUnreleased, or not applicable (explain below).env.live, logs, or generated test output committedOnly the TypeScript test harness changes. There are no SDK runtime, public API, timeout policy, fixture, or generated documentation changes, so no changelog or migration entry is needed. Examples and account-backed tests are not required for this local socket-cleanup fix. Go and Python do not use this Node test helper. Existing offline tests cover CJS, ESM, and subpath imports.