Repository navigation
test(zero-swift): keep frames that arrive with the WebSocket upgrade response - #49
Merged
Merged
Conversation
…response NIOTransport, the e2e tests' Linux transport, used NIO's default leftOverBytesStrategy (.dropBytes), so WebSocket frames in the same TCP read as the 101 response were discarded. Behind the chaos proxy's throttle, connected and pokeStart could share that read; the client then saw the poke's binary chunk alone and stopped with "received a binary poke chunk without pokeStart" (the flaky slowReaderLargePokeCompletesOnOneConnection failure). Forward the bytes to the WebSocket decoder instead. Amp-Thread-ID: https://ampcode.com/threads/T-01a17664-8fd0-76be-8fd5-75ac6e7aa0d8 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.
Fixes the flaky
slowReaderLargePokeCompletesOnOneConnectione2e failure (seen on #43: "received a binary poke chunk without pokeStart").Cause:
NIOTransport, the test-only Linux transport, used NIO's defaultleftOverBytesStrategy = .dropBytes. WebSocket frames that arrived in the same TCP read as the 101 response were thrown away. The chaos proxy's throttle batches bytes into 10 ms ticks, soconnectedandpokeStartcould land in that read, and the client then received the poke's binary chunk with nothing before it. The CI server log agrees: the client closed 20 ms afterinitConnection, and it had never handledconnected("Failed to connect").Fix: set
leftOverBytesStrategy = .forwardBytesso those bytes go to the WebSocket decoder.Scope: test harness only. Apps use
URLSessionTransport, so no changeset.Verification:
wsserver send two text frames right after the upgrade and a binary frame 100 ms later. Before the fix, 20/20 connections through the throttled proxy and 6/20 direct connections lost the text frames. After it, 40/40 got all three.--filter E2ETests: 19/19 pass.