Repository navigation
fix(zero-cache): don't crash when a handed-off socket closed on the way - #129
Merged
Merged
Conversation
When a connection closes while the runner sends it to the dispatcher, Node delivers the handoff message without the socket. Since #112 the dispatcher calls socket.on('error', …) as soon as the message arrives, so a missing socket threw a TypeError, an uncaught exception that exits zero-cache with code 13. main's Swift end-to-end job hit it at a0df53f: the dispatcher died at websocket-handoff.ts:80 right after the chaos fuzz cut two clients, and every later end-to-end test timed out. The dispatcher now drops such a message, as installWebSocketReceiver already does in the syncer. Amp-Thread-ID: https://ampcode.com/threads/T-0d2ed206-a5dd-4f42-9b68-c56e6b23e8f6 Co-authored-by: tmm <tmm@tmm.dev>
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.
main's Swift end-to-end (macOS) job failed at a0df53f (run 42909644773). 14 HardenE2ETests timed out, and ChaosFuzz seed 1 stopped converging. The cause is in zero-cache, not the Swift client. The job's
server.logartifact shows the dispatcher dying right after the chaos fuzz cut two clients:When a connection closes while the runner sends it to the dispatcher, Node delivers the
handoffmessage with no socket. The Node docs say message handlers in the subprocess "should verify that socket exists". Since #112, the dispatcher callssocket.on('error', …)as soon as the message arrives, so a missing socket throws, the exception goes uncaught, and the process exits. Before #112 the dispatcher only forwarded the socket, and the syncer'sinstallWebSocketReceiveralready checksif (!socket).With this change, the dispatcher drops such a message and logs
websocket closed during handoff, as the syncer does.The new test in
websocket-handoff.test.tsdelivers a handoff without a socket. On main it fails with the same TypeError; with this change it passes.tscand oxfmt are clean.No changeset: zero-cache isn't versioned here.