recovery: fix loss time selection across packet number spaces - #2701
Open
PranshulSoni wants to merge 1 commit into
Open
recovery: fix loss time selection across packet number spaces#2701PranshulSoni wants to merge 1 commit into
PranshulSoni wants to merge 1 commit into
Conversation
loss_time_and_space() compared Option<Instant> values directly, and in Rust None sorts before Some(_), so a packet number space without a loss time could overwrite an earlier space's valid deadline. When that happened, set_loss_detection_timer() missed the time-threshold loss detection deadline and on_loss_detection_timeout() fell through to the PTO path, delaying or skipping time-threshold loss detection. Ignore spaces without a loss time when selecting the earliest deadline, matching the GetLossTimeAndSpace() pseudocode in RFC 9002 Section 6.2.1, in both the legacy and gcongestion recovery implementations. Regression test fails before the fix and passes after.
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.
Fixes #2694
Summary
loss_time_and_space()in both recovery implementations comparedOption<Instant>values directly:In Rust,
None < Some(_)istrue, so a packet number space with no loss time could overwrite an earlier space's valid deadline. The RFC 9002 Section 6.2.1GetLossTimeAndSpace()pseudocode guards this withtime == 0checks: an absent deadline (0) must never replace an existing one.Concretely, with
Initial = Some(t+30ms),Handshake = Some(t+10ms),Application = None, the helper returned(None, Application)instead of(Some(t+10ms), Handshake). Bothset_loss_detection_timer()andon_loss_detection_timeout()then missed the time-threshold loss-detection branch: the timer fell through to the PTO path and pending time-threshold loss detection was delayed or skipped.Solution
Skip spaces without a loss time during the scan instead of comparing the options directly:
Applied identically to
quiche/src/recovery/congestion/recovery.rsandquiche/src/recovery/gcongestion/recovery.rs, which share the same helper logic but intentionally keep parallel implementations.Testing
loss_time_and_space_ignores_empty_spacesto both implementations' test modules, reproducing the exact scenario from the issue. Verified it fails against the pre-fix code (left: None, matching the reported behavior) and passes after the fix.cargo test -p quiche --lib: 1091 passedcargo test --workspace --all-targets --features=async,ffi,qlog: all passed (including BBR2-gcongestion parameterized tests)cargo test --doc --features=async,ffi,qlog --workspace: all passedcargo +nightly fmt -- --check: cleancargo clippy --features=async,ffi,qlog --workspace -- -D warnings: clean