Repository navigation
fix(quic,uring,congestion): wire bounds, CONNECT leftovers, and zero-RTT guards - #9353
Conversation
Quest-Claim: 047abceb57d604c5
…st record allowed
…s no cubic window credit
…the WebSocket read-buffer gap Review showed the stream transport reuses a buffer grown for a large record for later small ones, so max_record_size is the real bound on what a slice pins.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 seconds. View limit details
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. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. Each fix sits where the bad value is first produced: the MAX_STREAMS cap goes where max_remote grows, the varint cap where MAX_STREAM_DATA is computed, and the leftover bytes are kept at the one place the CONNECT is parsed. None of them adds a guard at the encoder.
Reviewed changes. I reviewed all 11 files at b443b37, including the accounting and callers around each fix.
MAX_STREAM_DATAvarint cap.limit()caps both the announced value and theshortcheck atVarInt::MAX. OnceVarInt::MAXhas been sent, neitherdiffnorshortasks for a resend.MAX_STREAMS2^60 cap. Cappingnew_countkeepsmax_remote - allocated_remote_countequal to the number of closed streams. Soremote_open_streamsstays correct, andqueue_max_stream_idstops queuing once the cap is reached.Datagrams::max_sizelocal check. It now matches the qmuxDatagrams::max_size, which already returnedNonewhen datagrams are disabled locally. The extra check insendwas redundant and is gone.moq-uringCONNECT leftovers.take_connectsplits off the headers, andRequest.restcarries the remaining bytes intoCapsules.frames.moq-tokiodoesn't have this bug: it parses throughweb_transport_proto::ConnectRequest::read, which reads exactly the HEADERS frame viastream.take(size).- Pacer 1 ns floor. This closes the window-path re-arm at
now, the same way the rate path already rounds its delay up. - Cubic zero RTT. With a zero RTT,
w_estis skipped and only the cubic curve applies, so a single ACK can no longer bank about 2^64 bytes ofcwnd_inc.
claude-opus-5-5 | 𝕏

Finishes quest/m1/precut-audit/quic-uring-congestion-fixes.md and deletes it.
Summary
VarInt::MAX. Before, raisingstream_receive_windowto the varint max on a live connection (Connection::set_limits, the relay-widening pathLimitsdocuments) panicked inwrite_varon the next MAX_STREAM_DATA. The "reader is short" check uses the same cap, so a capped limit is not resent forever.max_remotenever grows pastMAX_STREAM_COUNT(2^60). Before, withmax_streams = 2^60(whichLimits::validateaccepts), each freed stream pushed it past 2^60, and a peer that got that value in a MAX_STREAMS (after a loss, say) closed the connection with FRAME_ENCODING_ERROR.Datagrams::max_size()returnsNonewhendatagram.receive_bufferisNone, as its doc already said.sendalready refused in that case, so its separate check is gone.now, which stalls on a simulated clock.t / 0made it infinite, so one ACK banked about 2^64 bytes ofcwnd_incand the window then grew by an MSS on every ACK.Impact
moq_quicDatagrams::max_size()returnsNonewhen datagrams are disabled locally, as documented.Choices for review
Taken without the maintainer (user away). A later review can undo any of them:
Assembleritem (plan step 2). The review showed that.max(limit as usize)is the real bound:qmux::transport::Stream::poll_fillreuses a buffer grown for a large record (try_reclaim) to back later small ones, so a small slice can pinmax_record_size. The quest's overflow premise doesn't hold on 64-bit, because every over-threshold insert defragments, which resetsallocatedtobuffered. The cost it named (a copy per record) only applies under a non-defaultmax_record_size, and nothing in-tree raises it.mux/mod.rsis unchanged frommain, and no saturating arithmetic was added.max_remotegrows, not only when the frame is encoded. This keeps the local stream-limit check, retransmits, andqueue_max_stream_idagreeing on one value.w_esteffectively infinite.moq-uringRequestcarries the leftover bytes (rest) intoread_capsules. The decode step is now a puretake_connect, which is how it gets unit-tested.Validation
max_stream_data_stays_a_varint: panickedVarIntBoundsExceededatcoding.rs:128.max_streams_stays_under_the_stream_count_capdatagram_disabled_locallya_capsule_pipelined_with_the_connect_closes_the_session: a real io_uring server with a raw QUIC client writing CONNECT and a DATA-framed close capsule in one write. Unfixed, it timed out waiting for the close.sub_nanosecond_window_refill_still_waitszero_rtt_banks_no_window_credit: banked 18446744073709526415 bytes.Pairread data, then the server calledset_limitswithmax_streams = 2^60and both windows atVarInt::MAX. Onmain'srecv.rsit panicked atcoding.rs:128. With the fix it sent MAX_STREAM_DATA and stayed up.u32::MAXwindow). The fix sent 38.4 MB. Without the 1 ns clamp it stalled at one instant after 384 KB.just checkpasses on the head: 7588 tests, plus clippy, fmt, and the other checks.Caused by
read_connectdropped its buffer past the CONNECT HEADERS (found by reviewer).max_size's missing local check, the pacer's truncating delay, and cubic's unguardedw_estall date from the quinn-derived code, not a single PR here.Follow-ups
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm B)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: b443b37
Base: origin/main at f2965d8
Risk: medium,
These fixes change congestion pacing, QUIC flow-control limits and datagram reporting, and WebTransport capsule handling, so regressions could disrupt transport users, but preserve public APIs and wire formats and are fully undone by a revert.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a20208-83c1-7700-8b94-d10fa3a013e3Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a201fc-52d9-77d1-ac1a-8a47c58f590c, round 2Score: 10/10,
The accounting regression is fixed, and the changes since the previous review introduce no new findings.Rounds: 2; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0
Findings: none
The last round's findings, at f64fe81:
rs/moq-quic/src/connection/mux/mod.rs:672:Account for the backing allocation rather than record length;At the head, rs/moq-quic/src/connection/mux/mod.rs:676 restores size.max(MAX_FRAME_SIZE).max(limit as usize), matching the merge base and charging small slices for the potentially retained large buffer.