Repository navigation
fix(eio-client): close the probe transport when the probe fails - #5613
Open
mark1russell7 wants to merge 1 commit into
Open
mark1russell7 wants to merge 1 commit into
mark1russell7 wants to merge 1 commit into
Conversation
When the first packet received on the probe transport was not the expected "3probe" pong, the "upgradeError" event was emitted but the probe transport was not closed and its listeners were not removed. The probe WebSocket stayed open until the socket itself was closed, and "upgradeError" was then emitted a second time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The kind of change this PR does introduce
Current behavior
In
_probe(), when the first packet received on the probe transport is not3probe, the client emitsupgradeError, but it does not callfreezeTransport(), unlike the other failure paths (onerror,onTransportClose,onclose,onupgrade). The probe transport stays open, and its listeners stay on the socket: when the socket is closed later,upgradeErroris emitted a second time.New behavior
The branch calls
freezeTransport()before it emitsupgradeError: the probe transport is closed at once, its listeners are removed, andupgradeErroris emitted once.Other information (e.g. related issues)
Fixes #5612
The new test in
test/node.js("should close the probe transport when the probe fails") uses a small HTTP and WebSocket server that answers the probe with3invalid. It expects the server to see the probe WebSocket closed while the socket is stillopen, and exactly oneupgradeErrorevent, also aftersocket.close().Test results:
lib/folder ofmain(545e984) with the tests of this branch.USE_FETCH=1Full Node.js suites of the branch:
test/index.js99 passing, 1 pending (USE_FETCH=1: 98 passing, 2 pending);mainhas 98 and 97 passing.test/webtransport.mjs: 10 passing, 1 failing (see below).prettier --checkpasses on the changed files.The failure in
test/webtransport.mjsalso happens onmainin this environment: "should send some binary data (server to client) (as ArrayBuffer)" (a timeout of 2000 ms). Onmain, "should allow to upgrade to WebTransport" also failed with a timeout in the same run.This PR was prepared with AI assistance (Claude). The tests named above were run before and after the change, with the results above.
🤖 Generated with Claude Code