test(ws): walk the frames instead of sampling byte zero - #304
Merged
Merged
Conversation
Contributor
CoverageTotal lines: 83.19% → 83.16% (-0.03 pp)
|
`035-recv-queue-overflow` read the socket into one buffer and looked for the close opcode at its first byte, so anything the server sent ahead of the close left it parsing a data frame's header as a control frame. And `ws_read_frame` dropped a header it read only half of: `ws_take` returns what it got, the caller discarded it, and every frame after a torn read came out as garbage — `ws_pushback` exists for that and was not used. Neither is why the test fails on Windows. It still reads `NULL` there while the handler reports 1013, and the reason is in the server: the overflow path tears the transport down with the peer's bytes still unread, which resets the connection and discards the close it had queued. That is the shape #288 gave HTTP/1 a lingering close for, and the WebSocket path has none. Recorded in dev/PLAN.md as open.
EdmondDantes
force-pushed
the
ws-035-walk-the-frames
branch
from
August 26, 2026 05:48
677446d to
77c4c7b
Compare
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.
Two framing defects on the client side of the WebSocket tests, and one server-side finding that neither of them explains.
035-recv-queue-overflowread the socket into a single buffer and checked for the close opcode at byte 0, so anything the server sent ahead of the close left it reading a data frame's header as a control frame and never finding the close. It now walks frames.ws_read_framein_ws_client.incdropped a partially read header:ws_take($fp, 2, false)returns whatever arrived, the caller threw away a single byte and returned null, and every frame after such a read parsed as garbage.ws_pushbackexists for exactly this and was not used. A torn read is rare on loopback and likelier on Windows, so this had room to hide.Neither fixes the test on Windows, and I am not claiming it does. It still reads
client saw close: NULLwhile the handler side reports 1013, which means the decision is right and the frame does not arrive. The shape is the one #287 named for HTTP/1: the client writes about 16 KiB, the server caps the inbound queue at 8 KiB, stops reading, queues the close and tears the transport down atws_session.c:1345— and a socket closed with unread bytes in its receive buffer is reset rather than finished, which discards what this side has written. #288 gave HTTP/1 a lingering close for that; the WebSocket overflow path has none.That is recorded as an open item in
dev/PLAN.md, with the cheap proof named: cut the client's write to just past the cap so nothing is left unread, and see whether the close arrives.Evidence for what is here: the whole WebSocket group on Windows is 60 of 61 executed tests passing either way — these two changes remove latent misreads, not the failure.