Repository navigation
relay: a socket refused at the upgrade cannot take the process with it - #388
Merged
Merged
Conversation
Node's server stops listening for a socket's errors once it is handed to 'upgrade', and ws listens again only for the sockets it takes. One the relay refuses itself -- a document socket's 403, a room socket's 429 -- and its client then resets had its ECONNRESET emitted with no listener, which ends the process: jamtest's page rejoining after a cut did it. Every upgrading socket now has a listener that destroys it.
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.
Any client can crash the relay on master, ending every room on it.
The bug
'upgrade', andwsattaches its own listener only to the sockets it takes over.The fix
Every upgrading socket gets an error listener that destroys it.
Test
relaytest refuses a document upgrade, then resets it from the client, and checks the relay still answers. Without the fix, relaytest's in-process relay dies with ECONNRESET partway through the run. With it, all 126 checks pass.
The commit message also mentions a room socket's 429. That refusal comes with #377; on master the 403 is the path.