Repository navigation
test(cloudlink): QUIC fails after its dial in the demotion test - #1839
Merged
Merged
Conversation
TestAQUICSessionThatEndsBeforeHelloOKDemotesQUIC closed each QUIC session right after the handshake. When that close beat the end of the box's dial, the dial failed as on a path that blocks UDP, the WebSocket won the race, nothing was demoted, and the later QUIC win moved QUIC first. The service now closes once the box has opened its control stream, so the dial has succeeded and the session ends before hello_ok. Under load the QUIC handshake can also outlast the 250 ms race delay, so the WebSocket won before QUIC was tried. A test-only hook holds the fake service's WebSocket until QUIC is demoted on this network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Test-only.
TestAQUICSessionThatEndsBeforeHelloOKDemotesQUICfailed CI twice: run 39557013162 (master) and run 40178374052 attempt 3 (PR #1827).Cause
The test's QUIC listener closes each session right after the handshake. The box's QUIC dial does more after the handshake: it opens its control stream and writes the target. When the close beat those steps, the dial failed, as it would on a path that blocks UDP. The WebSocket then won the race normally, nothing was demoted, and the later
rememberWinner(QUIC)moved QUIC first. The code is right in both cases; the test only set up the case it meant some of the time.Fixing that showed a second timing assumption. Under load the QUIC handshake can take longer than
cloudwire.RaceDelay(250 ms), so the WebSocket won before any QUIC session reached the listener (QUIC was never tried, 2 of 800 runs).Fix
hello_ok, which is the case under test.beforeWebSocket, holds each WebSocket upgrade until the link has put the WebSocket first on this network (bounded at 20 s). QUIC therefore always has its failed session first, however slow the handshake.Evidence
Race detector, 8 parallel copies ×
-count=100of this test (800 runs):a QUIC win moved "quic" firstQUIC was never triedlisten udp …: bind: address already in useThe bind failure is a separate, local-only issue: the test listens for UDP on the same port number as the fake service's TCP listener, and another process's UDP socket can hold it. CI has never shown it, and this PR leaves it alone.
Whole
internal/cloudlinkpackage under the race detector passes (73 s).go vetpasses.Review
An independent review (Sonnet) found no bug. It delayed the server's first UDP read by 600 ms: with the hold, 10 of 10 runs passed under
-race; without it, 6 of 6 failed withQUIC was never tried. It also broke the code on purpose: whenrememberWinnerignores the demoted flag, the test fails 5 of 5; whendemoteis never called, it fails after 20 s without hanging. Small risk it noted: after the demotion, a WebSocket slower than 250 ms lets QUIC start second and fail again, which doubles the backoff; several in a row could pass the 20 s wait. Not seen.Not changed
TestTheBoxFollowsAWrongShardCloseOnceAndKeepsTheHostfailed once in CI (run 39908891473,no roster within 5safter the restart). It did not fail in 1,000 local runs under the same load, and I found no cause I could show. I did not change it.🤖 Generated with Claude Code