Repository navigation
Make the stalled-browser relay test reach a stalled send - #45
Merged
rogers-andrew merged 1 commit intoDec 3, 2026
Merged
rogers-andrew merged 1 commit into
rogers-andrew merged 1 commit into
Conversation
The test sent one 32 MiB frame, but the relay reads the Gateway under tungstenite's default 16 MiB `max_frame_size`, so it refused the frame before forwarding it and no browser send ever stalled. On Linux the Gateway double's send then failed when the relay dropped the socket, the probe never fired, and the test failed after `RECV_TIMEOUT` at its first wait. Behind that, the browser read as soon as the probe fired, and a read makes room for a stalled send to finish inside `RELAY_IO_DEADLINE`; the 750 ms wait that c2e70f6 removed had been holding that read back. - `send_frames_until_the_relay_lets_go` sends up to `STALL_FRAMES` frames of `STALL_FRAME_BYTES`, each under the frame cap and together more than the sockets between the relay and the browser hold, then reports when the relay drops the Gateway socket, which it does only once it has given up on the browser. - The browser reads nothing until that report, and the test asserts that fewer than all the frames reach it, since frames the sockets took before the stall can arrive whole. - The test is now `a_stalled_browser_send_is_canceled_within_the_relay_deadline`: the relay gives up while the Gateway is still connected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rogers-andrew
marked this pull request as ready for review
December 3, 2026 04:45
rogers-andrew
force-pushed
the
fix-stalled-browser-relay-test
branch
from
December 3, 2026 04:45
0c0248c to
6946d46
Compare
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
This pull request fixes
stalled_browser_cleanup_is_bounded_after_gateway_disconnect, a test ofworkshop-serverthat fails on Linux on every run, on unchanged code (#32 noted the failure). CI runs the tests of the Workshop crates only in its Windows job, so CI has not shown it. The change touches two test files and no product code.The test never reached a stalled send
The test's stand-in Gateway sent one 32 MiB binary frame. The relay connects to the Gateway with
connect_async, so it reads the Gateway under tungstenite's defaultWebSocketConfig, whosemax_frame_sizeis 16 MiB. The relay refuses the frame as soon as its header arrives, closes the browser, and returns, which drops both sockets. It never starts a browser send, so nothing stalls.RECV_TIMEOUTat "the Gateway fills the relay's browser send".A second problem sat behind the first. The test first waited 750 ms, longer than
RELAY_IO_DEADLINE, before the browser's first read.c2e70f6eremoved that wait as redundant, but the read is what lets a stalled send finish. With the frame made 15 MiB, under the cap, the browser received the whole frame within 69 ms and the last assertion failed.Why the test is wrong and the relay is right
bounded, which gives up afterRELAY_IO_DEADLINE, and the relay then returns and drops both sockets.What the test does now
STALL_FRAMES(16) frames ofSTALL_FRAME_BYTES(8 MiB). Each frame is under the cap, and together they are more than the sockets between the relay and the browser can buffer. It then reports when the relay drops the Gateway socket, which the relay does only once it has given up on the browser.c2e70f6eintended, in place of the 750 ms sleep.a_stalled_browser_send_is_canceled_within_the_relay_deadline, because the relay now gives up while the Gateway is still connected, not after it disconnects.How it was checked, on Linux
RELAY_IO_DEADLINEraised to 60 s, it fails after 10 s at "the relay gives up on a browser that never reads".cargo nextest run --locked -p workshop -p workshop-server -p workshop-server-api(with a stub Gateway sidecar staged, as CI does),cargo clippy --locked -p workshop -p workshop-server -p workshop-server-api --all-targetswithCARGO_BUILD_WARNINGS=deny,cargo fmt --all --check, andcargo test --locked -p build-xtaskpass, apart from one unrelated test noted below.gateway::tests::identity::server_publication_replaces_a_mismatched_candidate_and_cleans_it_up, in theworkshopdesktop crate, failed after 81 s withHealthFailed. That was under load, beside the Gateway-spawning tests. Run alone it passed three times out of three, in about 0.35 s. This change does not touch it.🤖 Generated with Claude Code