joule-moq-relay test: the client closes after the relay holds its session (WebTransport close flake) #391

Merged
dcharlot merged 1 commit from fix/wt-close-linger into main 2026-10-21 10:18:40 -04:00
Owner

Fixes the flake in joule-moq-relay/tests/webtransport_close.rs (line 101, "the relay records the client's code: []"). It has failed CI on #365, #383 and #387.

Cause

  • The relay sends its SETUP first and reads the client's SETUP after.
  • A client has its handshake as soon as the relay's SETUP arrives. The test closed it at that instant.
  • Under load, the relay could see that close before it read the client's SETUP. That is a session never served, so the relay keeps no session and records no summary. The test then waited 20 s for a summary that would never come.

The diagnosis took a few steps, all on the build host under artificial load (16 concurrent copies, load average 37–51):

  1. Reproduced on main: 10 of 48 failed.
  2. Ruled out the close linger: raising the vendored driver's linger from 2 s to 10 s didn't help (14 of 48 failed).
  3. Measured: the summary arrives in under 50 ms or never; there is no slow middle.
  4. Instrumented: in failing runs cleanup() never ran, and the relay held no open session.

Fix

The test waits until the relay holds the session before the client closes. That is what the step means to test: a client closing an established session. The relay is unchanged. A session that closes before its SETUP is read was never served, and giving it a summary would change the metering's session counts.

Check

  • After the fix: 64 of 64 under the same stress (load average 51).
  • Before it: 10 of 48.

🤖 Generated with Claude Code

Fixes the flake in `joule-moq-relay/tests/webtransport_close.rs` (line 101, "the relay records the client's code: []"). It has failed CI on #365, #383 and #387. ## Cause - The relay sends its SETUP first and reads the client's SETUP after. - A client has its handshake as soon as the relay's SETUP arrives. The test closed it at that instant. - Under load, the relay could see that close before it read the client's SETUP. That is a session never served, so the relay keeps no session and records no summary. The test then waited 20 s for a summary that would never come. The diagnosis took a few steps, all on the build host under artificial load (16 concurrent copies, load average 37–51): 1. **Reproduced on main:** 10 of 48 failed. 2. **Ruled out the close linger:** raising the vendored driver's linger from 2 s to 10 s didn't help (14 of 48 failed). 3. **Measured:** the summary arrives in under 50 ms or never; there is no slow middle. 4. **Instrumented:** in failing runs `cleanup()` never ran, and the relay held no open session. ## Fix The test waits until the relay holds the session before the client closes. That is what the step means to test: a client closing an established session. The relay is unchanged. A session that closes before its SETUP is read was never served, and giving it a summary would change the metering's session counts. ## Check - After the fix: 64 of 64 under the same stress (load average 51). - Before it: 10 of 48. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
joule-moq-relay test: the client closes after the relay holds its session
All checks were successful
joule-moq-room room service / joule-moq-room · does this change touch it (pull_request) Successful in 15s
joule-moq-web browser client / joule-moq-web · does this change touch it (pull_request) Successful in 13s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Successful in 3m27s
joule-code conformance gate / joule-moq-ingest, every target (pull_request) Successful in 1m16s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 5s
joule-code conformance gate / joule-moq-relay, every target (pull_request) Successful in 1m32s
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 47s
joule-moq-room room service / joule-moq-room, every target (pull_request) Successful in 58s
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Successful in 5m52s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 3m23s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m35s
ccc1fb3872
The relay sends its SETUP first and reads the client's after it; a client that closed the
moment it had the relay's SETUP could close before the relay read its own, a session never
served, with no summary. Under load (CI) that race lost the summary about one run in five.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!391
No description provided.