Files
amethyst/quic
Vitor Pamplona d1567e4a53 fix(quic): faster PTO with INITIAL_RTT=100ms and unified ptoBaseMs path
multiconnect handshakeloss / handshakecorruption tail-fail under the
runner's 30% packet drop / bit-flip scenarios because each PTO retransmit
chance gives ~49% one-side success (0.7² for both directions clear). With
INITIAL_RTT=333ms the first PTO fires at 999 ms and doubling tops out
at ~5 attempts in 30s — across 50 sequential connections, ~5% probability
some iteration runs out of retransmits before the per-iter budget.

Two coupled changes:

1. INITIAL_RTT_MS 333→100. RFC 9002 §6.2.2 spec-allowed (the standard
   default but explicitly configurable). Matches Chrome and
   Firefox/neqo. Pre-sample PTO is now 300 ms instead of 999 ms;
   doubling fits ~8 retransmit attempts in 30s instead of 5,
   pushing per-iter loss-recovery success past 99% under 30% drop.
   Spurious retransmits on slow paths are harmless (peer dedupes
   by packet number) and smoothed_rtt converges in one round-trip.

2. QuicConnectionDriver always uses lossDetection.ptoBaseMs() for the
   PTO timer, including before the first RTT sample. Pre-fix the
   driver hardcoded 1000ms as a "handshake-timeout safety floor"
   that ignored INITIAL_RTT_MS entirely — the PTO was always 1s
   pre-handshake regardless of the constant. Now both pre- and
   post-sample regimes go through the same calculation.

   max_ack_delay is gated to APPLICATION space (RFC 9002 §6.2.1) so
   pre-handshake PTOs aren't padded with the peer's quoted delay.

Two pre-existing tests (PtoTest, QuicLossDetectionTest) hard-coded
expected PTO durations derived from the old 333 ms constant; updated
them to express the relationships in terms of INITIAL_RTT_MS so future
tweaks don't desync.

Result: 21/21 against aioquic, picoquic, quic-go (handshake,
multiplexing, longrtt, transferloss, transfercorruption,
handshakeloss, handshakecorruption all pass on each peer).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:42:33 -04:00
..