Skip to content

fix(quic): keep the MTU search above its confirmed size - #9805

Merged
kixelated merged 2 commits into
mainfrom
fix/quic-mtu-lower-bound
Nov 28, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/quic-mtu-lower-bound

Conversation

@kixelated

@kixelated kixelated commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Two CodeRabbit points left on #9801:

  • MTU search below its lower bound: real. With minimum_change = 1, lower 1200 and upper 1201, losing 1201 three times probes 1200 (already confirmed), and losing that three times inverts the range and probes 1199. An ACK then sets current_mtu below min_mtu. With minimum_change = 2 the search still wastes probes on the confirmed size. Reproduced: the new test failed on main with [1201, 1201, 1201, 1200, 1200, 1200, 1199].
  • Test strength: stop_recovers_a_dropped_lease checked only credit_stats().leased, not that the peer gets the credit back.

Approach

  • SearchState::next_mtu_to_probe takes the candidate range as (largest confirmed, largest not ruled out], returns None once it is empty, and never picks the confirmed size itself. Every probe is now above lower_bound, so the retransmit upper bound (last_probed_mtu - 1) can never fall below it. The success branch's behavior is unchanged (existing exact-sequence tests pass as is).
  • search_probes_only_above_its_lower_bound sweeps upper bounds 1201..1209, minimum_change 1..3, and every link limit (including one that loses every probe), asserting every probe lies in 1201..=upper_bound, the search completes, and current_mtu stays between 1200 and the link limit. Time is Instant::ZERO throughout.
  • stop_recovers_a_dropped_lease also asserts local_max_data rises by the returned credit and the stop queues MAX_DATA.
  • rs/moq-quic/README.md lists the fix under carried changes.

Impact

  • No public API or wire change. Behavior: MTU discovery with minimum_change of 1 or 2 no longer re-probes its confirmed size or adopts an MTU below it.

Caused by

Decisions

  • Fixed at the candidate range rather than CodeRabbit's suggested clamp (last_probed_mtu.saturating_sub(1).max(lower_bound)), which would still re-probe the confirmed size.
  • No debug assertion on upper_bound >= lower_bound: the sweep test covers it, and every probe being above lower_bound makes it hold by construction.

Alternatives

  • Rounding the midpoint up everywhere: equivalent fix, but shifts existing probe sequences by one byte for no gain.

Follow-ups

  • None.

Validation

  • New sweep test failed on main, passes with the fix; all 33 mtud tests pass.
  • Mutation check: skipping grant() in add_read_credits fails the strengthened lease test only on the new local_max_data assertion, which the old assertions missed.
  • quest gate just check passes.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 31d8928

  • Base: origin/main at d0beaa0

  • Risk: medium, A bug in the MTU search's bounds could make a relay or client probe the wrong packet sizes, so a connection settles on a smaller or unstable MTU, hurting throughput for the peers of the moq-quic crate and not breaking the API or wire format; the change is a behavior fix in shipped code that a revert fully undoes, and the state.rs edit is test-only and the README line is documentation.

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session 11532d8a-4b3b-4ab1-9798-e95ebc02800f

  • Risk file: bb7b1c0de60b

  • Reviewer: Codex, gpt-6.2-sol, medium effort

  • Session: 01a21f68-d476-7853-b0db-5df21925b562, round 2

  • Score: 10/10, The regression test now checks each probe against the latest confirmed MTU, and the README accurately describes the retry and stopping conditions.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 27, 2026 15:47
After a lost probe, the binary search re-probed its lower bound and, with
minimum_change 1, could invert its range and adopt an MTU below min_mtu.
Probe only sizes above the confirmed one and end when none remain.

Also assert that stopping a stream with a dropped lease grants its credit
back to the peer in a MAX_DATA frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 28, 2026 00:02
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The MTU search now selects probes above the largest confirmed size and stops when no valid probe remains. A new test checks probe bounds and the final confirmed MTU. The README documents the search behavior. A stream test now checks that stopping a stream returns held credit and queues a MAX_DATA frame.

Merge Risk: Minimal · up to 31d89

This change stops QUIC MTU discovery from re-probing the confirmed size or adopting an MTU below the minimum. It also strengthens a stream credit test. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the MTU search now stays above its confirmed size. It uses the conventional fix(quic) prefix and matches the changeset's core fix in mtud.rs, the new sweep test, and t…
Description check Passed The description is directly related to the changeset. It explains the MTU search lower-bound bug and the candidate-range fix in mtud.rs, the new search_probes_only_above_its_lower_bound sweep test, th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the MTU search now stays above its confirmed size. It uses the conventional fix(quic) prefix and matches the changeset's core fix in mtud.rs, the new sweep test, and the README entry. It does not cover the secondary lease-credit test change, which is expected.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains the MTU search lower-bound bug and the candidate-range fix in mtud.rs, the new search_probes_only_above_its_lower_bound sweep test, the strengthened stop_recovers_a_dropped_lease assertions on local_max_data and MAX_DATA, and the README update. It also gives validation details.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ada2ce6-ed2a-4630-ab4b-0ff61d634d0e
Commits

Reviewing files that changed from the base of the PR and between d0beaa0 and 31d8928.

Files selected for processing: 3

  • rs/moq-quic/README.md
  • rs/moq-quic/src/connection/mtud.rs
  • rs/moq-quic/src/connection/streams/state.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@kixelated
kixelated added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 4cfb6b0 Nov 28, 2026
5 checks passed
@kixelated
kixelated deleted the fix/quic-mtu-lower-bound branch November 28, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant