Files
Vitor PamplonaandClaude Opus 5.5 f335b8722d fix(geode): send the 1009 close before dropping an oversized-frame client
KtorRelayFrameLimitTest.aFrameOverTheLimitClosesTheConnection failed on CI
(close code null instead of 1009). Most of it was the relay, not the test.

When Ktor refuses a frame it queues the close (1009, or 1002 for a protocol
violation) and ends the incoming stream with FrameTooBigException.
WebSocketSessionPump let that escape the handler, so Ktor logged the handler
as failed and dropped the socket without waiting for the queued close: the
client saw a bare EOF. The pump now returns normally on those two
exceptions, and Ktor closes the session and waits for it.

The rest was the test's client. OkHttp writes the whole 128 KB message, so
the relay closes with the payload unread and the reset can reach the client
before the 1009, which OkHttp reports as a broken pipe. The test now sends
the frame header alone (claiming 2 GB, as the class comment describes) over
a raw socket and reads the close frame.

Linux (Docker, --cpus=0.5), 600 runs each:
- without the pump fix: raw test 15 failures (EOF, no 1009); OkHttp 15 EOF
  and 1 broken pipe
- with it: raw test 600 passes; OkHttp 600 closes with 1009
macOS never reproduced it (0 of 300).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:28:28 -04:00
..