Repository navigation
fix(moq-quic): fix two handshake stalls under a short idle timeout #5163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3367412
quest: claim impaired-handshake
kixelated af7f1d2
fix(moq-quic): reset the PTO backoff when discarding Initial or Hands…
kixelated 4db5acf
feat(moq-quic): add a handshake idle timeout
kixelated db8d267
Merge remote-tracking branch 'origin/main' into quest/m1/test-flakes-…
kixelated 6d228d0
test(moq-quic): an established connection idles out at the negotiated…
kixelated 5e4ce04
fix(moq-quic): a deferred accept gets the handshake idle timeout
kixelated 37be2e8
fix(moq-quic): an unrepresentable idle deadline never fires
kixelated 64f4ffd
Merge remote-tracking branch 'origin/main' into quest/m1/test-flakes-…
kixelated d515467
quest: drop two Required blockers that already merged
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,47 @@ | ||
| # [S] Impaired drill clients connect reliably | ||
| # [XS] Impaired drill clients connect reliably | ||
|
|
||
| ## Goal | ||
|
|
||
| The impaired cluster drills (`bursts_cross_a_cluster::impaired`, | ||
| `bursts_cross_a_flapping_peer::impaired` in `rs/moq-relay/tests/drills.rs`) | ||
| never fail while connecting their publisher or subscriber. | ||
| The impaired drills (`bursts_cross_a_cluster::impaired`, | ||
| `bursts_cross_a_flapping_peer::impaired`, and | ||
| `interrupted_publisher_republishes_new_content::impaired` in | ||
| `rs/moq-relay/tests/drills.rs`) never fail while connecting their publisher or | ||
| subscriber. | ||
|
|
||
| ## Plan | ||
|
|
||
| Measured 2026-10-07 by running the built drill binary in a loop (four tests | ||
| in parallel): | ||
|
|
||
| - `main` at `fe0113ff2`: 1 of 40 runs failed `publisher connect failed: | ||
| Noq(Connection("timed out"))`, seed 3495212678159036442. | ||
| - #4972, with both relays back on the default 10s idle timeout: 3 of 40 runs, | ||
| `subscriber connect failed: Noq(Connection("timed out"))` twice and once | ||
| `failed to exchange h3 settings: ... reset by peer`. | ||
|
|
||
| So the relays' idle timeout is not the cause. The likely cause is the drills' | ||
| 2s client idle timeout (`quic()`) against a handshake over 5% loss and a | ||
| 100 kbit/s bottleneck: noq arms the idle timer at `max(idle, 3 * PTO)` with | ||
| the base PTO, while a backed-off PTO can leave the client silent longer than | ||
| that. Confirm with a qlog of a failing seed, then fix it at the cause, without | ||
| raising a timeout or retrying the connect. | ||
|
|
||
| Public API: none. Wire: none. | ||
| Both causes are fixed in the QUIC stack, in `moq-quic` (#5163) and in | ||
| moq-dev/noq ([#32](https://github.com/moq-dev/noq/pull/32) and | ||
| [#34](https://github.com/moq-dev/noq/pull/34), stacked). The drills still run | ||
| on `moq-noq`, and [the switch](/quest/m1/quic/fork/switch.md) is not started, | ||
| so what remains is to bump the `moq-noq-proto` pin to a release carrying both | ||
| noq PRs. Then loop the impaired drills under load (four to eight in parallel, | ||
| a few hundred runs each) and confirm that no connect fails. | ||
|
|
||
| The causes, from qlogs of failing runs (2026-10-09). Both are the drills' 2s | ||
| client idle timeout meeting a backed-off PTO during the handshake. | ||
|
|
||
| 1. **A lost Finished waited on the Initial backoff** (`reset by peer`). | ||
| RFC 9002 A.11 resets `pto_count` when Initial or Handshake keys are | ||
| discarded; noq and quinn did not. The server, which cannot read 1-RTT | ||
| before the Finished, idled out first. Fix: reset `pto_count` in | ||
| `discard_space`. | ||
| 2. **Two Initial flights per idle window** (`timed out`). The idle timer was | ||
| armed at `max(2s, 3 * 999ms)` = 2997ms, and the second probe is due at | ||
| 2997ms plus timer slop. Decided 2026-10-09: add a separate | ||
| `handshake_idle_timeout` (default 10s, as msquic does) that governs until | ||
| the handshake completes. Dead-peer detection on established connections is | ||
| unchanged. The rejected options were capping the handshake probe interval | ||
| (it touches the PTO deadline's monotonic invariant) and flooring the idle | ||
| timer at the backed-off PTO (it slows dead-peer detection). | ||
|
|
||
| With the bump, a handshake to an unreachable relay waits 10s instead of about | ||
| 3s. Check that the crash drill's reconnect loop (`dial()`'s 5s backoff | ||
| timeout) still holds. | ||
|
|
||
| Public API: none in this repo; `moq-quic` and `moq-noq-proto` gain | ||
| `TransportConfig::handshake_idle_timeout`. Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Switch](/quest/m1/quic/fork/switch.md) - moves the runtimes from noq to `moq-quic`, whose idle-timer arming a fix may land in instead | ||
| - [Switch](/quest/m1/quic/fork/switch.md) - moves the runtimes from noq to `moq-quic`, which already carries both fixes |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a server delays
Endpoint::start_accept, the stale-Initial check inendpoint.rs:602-607still usesmax_idle_timeout. With a 2s idle timeout and the new 10s handshake timeout, an Initial accepted after 2s is therefore rejected even though this API promises the handshake timeout replaces the idle timeout until establishment. Usehandshake_idle_timeoutfor that check so manually accepted server handshakes receive the configured window.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, fixed in
5e4ce04d. The stale-Initial check now useshandshake_idle_timeout. New testdeferred_accept_uses_handshake_idle_timeout: with a 2s idle timeout, an Initial accepted 3s late succeeds and one accepted 10s late is refused withTimedOut. It fails without the change.(Written by Claude Opus 5.5)