Repository navigation
fix(moq-quic): stream, Assembler, QMux close, BloomTokenLog, CidState, rate-cap, and 32-bit wire bugs - #9716
Conversation
Quest-Claim: 0a90fb9dd5057a48
…, rate-cap, and 32-bit wire bugs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThis PR changes QUIC stream handling, CID expiration, Bloom-token filtering, close-frame encoding, and packet parsing. It adds tests for stream writes and acknowledgements, CID retirement, token filtering, close-frame budgets, and oversized packet lengths. The README documents inherited fixes, and the audit-plan document is removed. Merge Risk:
|
|
quest land watch: the merge queue removed this pull request at 06a3dcd because its The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs.
…9 hits, 94 misses, 0 bypassed, 0 not looked up; ~3.24s compiler work saved
mbx[progress]: 25m elapsed; 9 hits, 126 misses, 0 bypassed, 0 not looked up; ~3.24s compiler work saved
Checking moq-bench v0.1.0 (/var/cache/github-runner-work/moq/moq/rs/moq-bench)
error: recipe `cross-lint-changed` was terminated on line 110 by signal 15
##[endgroup]
##[error]ci: test rs failed
##[error]Process completed with exit code 100.
##[group]Run actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: cargo-timings
path: target/cargo-timings/cargo-timing-*.html
if-no-files-found: ignore
retention-days: 14
compression-level: 6
overwrite: false
include-hidden-files: false
archive: true
env:
BASE: dc87b3cfb15a9edca72f437b5a89d907271f9e93
CHECK_FAIL_FAST: 1
NEXTEST_TEST_THREADS: 24
MBX_CACHE_LINKS: 1
MBX_REMOTE_URL:
##[endgroup]
With the provided path, there will be 5 files uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: cargo-timings.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 305592
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 5dc3135beff93662de259384ee372a59207dd72b8f8a5f42a2e59e92de6e9aad
Finalizing artifact upload
Artifact cargo-timings successfully finalized. Artifact ID 15162119935
Artifact cargo-timings has been successfully uploaded! Final size is 305592 bytes. Artifact ID is 15162119935
Artifact download URL: https://github.com/moq-dev/moq/actions/runs/45914103179/artifacts/15162119935
Post job cleanup.
##[start-action display=Run jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de;id=__e562dfb1-664a-4753-9eae-9e83f7b5a219.mbx]
##[end-action id=__e562dfb1-664a-4753-9eae-9e83f7b5a219.mbx;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git version
git version 2.56.0
Temporarily overriding HOME='/var/cache/github-runner-work/_temp/c83585d9-6a2e-4fe3-9277-a0a924a2d0b0' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --global --add safe.directory /var/cache/github-runner-work/moq/moq
Removing SSH command configuration
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 263 objects and 6 action results (3.3 GiB logical); 50.0 GiB logical remain
dropped 1 session event streams
Cleaning up orphan processes
Current runner version: '2.338.2'
Runner name: 'nixos-moq-ci'
Runner group name: 'moq-queue'
Machine name: 'moq-ci'
##[group]GITHUB_TOKEN Permissions
Checks: write
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Uses: moq-dev/moq/.github/workflows/queue-build.yml@refs/heads/main (dc87b3cfb15a9edca72f437b5a89d907271f9e93)
Complete job name: Queue build / Report Queue
A job started hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
##[group]Run conclusion=failure
�[36;1mconclusion=failure�[0m
�[36;1m[[ "$RESULT" == success ]] && conclusion=success�[0m
�[36;1mgh api "repos/$REPO/check-runs" -f name=Queue -f head_sha="$SHA" -f status=completed -f conclusion="$conclusion" \�[0m
�[36;1m -f 'output[title]=Queue' -f "output[summary]=The queue build ended $RESULT." --silent�[0m
�[36;1m[[ "$RESULT" == success ]] || { echo "::error::the queue build ended $RESULT" >&2; exit 1; }�[0m
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash -e {0}
env:
GH_TOKEN: ***
REPO: moq-dev/moq
SHA: 8e5bff14bf419d59fbece4b9032923f5e5e55411
RESULT: failure
##[endgroup]
##[error]the queue build ended failure
##[error]Process completed with exit code 1.
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
Cleaning up orphan processes
(GitHub has no log for this job: HTTP 404) (written by quest land watch) |
|
claude, claude-opus-5-5, medium effort land fixer note:
(written by claude, claude-opus-5-5, medium effort) |
|
quest land watch: re-enqueued this pull request at 06a3dcd, at the back of the merge queue, unchanged, since the land fixer judged the failure flaky: (written by quest land watch) |
|
quest land watch: the merge queue removed this pull request at 06a3dcd because its The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs.
…oq v0.7.0 (/var/cache/github-runner-work/moq/moq/rs/libmoq)
mbx[progress]: 15m elapsed; 0 hits, 95 misses, 0 bypassed, 0 not looked up; ~0s compiler work saved
mbx[progress]: 20m elapsed; 0 hits, 121 misses, 0 bypassed, 0 not looked up; ~0s compiler work saved
error: recipe `cross-lint-changed` was terminated on line 110 by signal 15
##[endgroup]
##[error]ci: test rs failed
##[error]Process completed with exit code 100.
##[group]Run actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: cargo-timings
path: target/cargo-timings/cargo-timing-*.html
if-no-files-found: ignore
retention-days: 14
compression-level: 6
overwrite: false
include-hidden-files: false
archive: true
env:
BASE: 9ad325dbce6f4780be36640e084818ff8644de2e
CHECK_FAIL_FAST: 1
NEXTEST_TEST_THREADS: 24
MBX_CACHE_LINKS: 1
MBX_REMOTE_URL:
##[endgroup]
With the provided path, there will be 6 files uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: cargo-timings.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 379709
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 982ba8d2e4304a557ab6e40ba04ad789ff6eb115b004f618a2010f4ba89fa143
Finalizing artifact upload
Artifact cargo-timings successfully finalized. Artifact ID 15163909738
Artifact cargo-timings has been successfully uploaded! Final size is 379709 bytes. Artifact ID is 15163909738
Artifact download URL: https://github.com/moq-dev/moq/actions/runs/45918972829/artifacts/15163909738
Post job cleanup.
##[start-action display=Run jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de;id=__68ff602f-d534-4542-8a36-1f0021ad5327.mbx]
##[end-action id=__68ff602f-d534-4542-8a36-1f0021ad5327.mbx;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git version
git version 2.56.0
Temporarily overriding HOME='/var/cache/github-runner-work/_temp/ca25ea2a-7c5a-4800-99fd-4482d0684a63' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --global --add safe.directory /var/cache/github-runner-work/moq/moq
Removing SSH command configuration
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 400 objects and 80 action results (2.9 GiB logical); 49.9 GiB logical remain
dropped 8 session event streams
Cleaning up orphan processes
Current runner version: '2.338.2'
Runner name: 'nixos-moq-ci'
Runner group name: 'moq-queue'
Machine name: 'moq-ci'
##[group]GITHUB_TOKEN Permissions
Checks: write
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Uses: moq-dev/moq/.github/workflows/queue-build.yml@refs/heads/main (9ad325dbce6f4780be36640e084818ff8644de2e)
Complete job name: Queue build / Report Queue
A job started hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 49.9 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 49.9 GiB logical remain
##[group]Run conclusion=failure
�[36;1mconclusion=failure�[0m
�[36;1m[[ "$RESULT" == success ]] && conclusion=success�[0m
�[36;1mgh api "repos/$REPO/check-runs" -f name=Queue -f head_sha="$SHA" -f status=completed -f conclusion="$conclusion" \�[0m
�[36;1m -f 'output[title]=Queue' -f "output[summary]=The queue build ended $RESULT." --silent�[0m
�[36;1m[[ "$RESULT" == success ]] || { echo "::error::the queue build ended $RESULT" >&2; exit 1; }�[0m
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash -e {0}
env:
GH_TOKEN: ***
REPO: moq-dev/moq
SHA: e002b016250b5d028ceb59d3b9c7c7985073eea7
RESULT: failure
##[endgroup]
##[error]the queue build ended failure
##[error]Process completed with exit code 1.
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 49.9 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 49.9 GiB logical remain
Cleaning up orphan processes
(GitHub has no log for this job: HTTP 404) (written by quest land watch) |
|
claude, claude-opus-5-5, medium effort land fixer note:
(written by claude, claude-opus-5-5, medium effort) |
|
quest land watch: re-enqueued this pull request at 06a3dcd, at the back of the merge queue, unchanged, since the land fixer judged the failure flaky: (written by quest land watch) |
Finishes quest/m1/quic-stream-and-wire-fixes.md (deleted here).
Problem
The
moq-quicaudit (moq-dev/moq#9707) found correctness and panic bugs in stream state, the receiveAssembler, QMux close encoding,BloomTokenLog,CidState, the send rate cap, and the wire decoders on 32-bit targets.Approach
Each fix comes with a unit test that fails without it, except the two noted under Validation.
Assembler: compaction frominsertstarts atbytes_read, so bytes already read are dropped instead of copied and counted.truncatelowersend(but never belowbytes_read), so the unique-bytes bound that triggers compaction stays tight.RESET_STREAMretransmit:Retransmits::is_emptycounts a queued reset only whileStreamsState::can_send_resetsays it would still be written. Without this, a lostRESET_STREAM_ATrequeued after its STOP_SENDING replacement was acknowledged demanded a packet with nothing to put in it.send::Stream::poll_writewith an empty buffer returnsOk(0). It queues no 0-byte STREAM frame, takes noScheduleslot, and never blocks on or queuesDATA_BLOCKED/STREAM_DATA_BLOCKED. It still reportsClosed/Stopped.Send::acked: checksacked_len(), which includes data acknowledged before a reset truncated the buffer, before checking the truncatedpending.offset(). An acknowledged offset now stays acknowledged while aRESET_STREAM_ATlingers.ConnectionClose/ApplicationClose::encodesubtract the header's exact varint widths withsaturating_sub, so a small budget drops the reason instead of panicking. QMuxfill_intousesbudget.saturating_sub(buf.len()). When the transport parameters leave less thanClose::SIZE_BOUND, the close goes in the next record.usize::try_from(saturating), and the ACK block count stays au64. A length of 2^32 now fails decode on ARMv7 instead of wrapping to 0.BloomTokenLog:new_expected_itemscomputes k for each of the two half-sized filters (29 instead of 58 hashes by default). TheDefaultdoc now says 10 MiB, which is what it allocates. A full turnover now starts period 1 at the triggering token's issue time instead of its expiry. Every token still valid expires after now, so none can land before period 1. Before, a valid token issued just before the first one redeemed was refused.CidState:on_cid_timeoutpops an expiry batch only when the peer has retired everything the previous Retire Prior To asked for.next_timeoutisNonewhile those retirements are pending. EachRETIRE_CONNECTION_IDsyncsTimer::PushNewCidto the next eligible batch, so a batch neither gets dropped nor makes the timer spin. A batch whose CIDs the peer has all retired is dropped, so every queued batch holds an active CID and the queue stays within the active CID count while the peer withholds a retirement.finish_and_trackrefills the bucket atnowbefore charging. Packets that skip the cap'sdelaycheck (MTU probes, off-pathPATH_RESPONSE) used to charge a bucket last refilled long ago, and the next refill credited that idle time back.validate_receive_id: checks a peer's stream againstsent_max_remote(the limit announced inMAX_STREAMS), asvalidate_send_idalready did.Choices made without asking:
nowonreceive_rategrants. Every receive charge already followsgrant_receive_rate(now)at the start ofprocess_payload. The only grant without a clock is a reader returning credit (add_read_credits). That grant uses the last refill, so it can only under-grant, and the credit deadline anchored at that refill fires right away to grant the rest. Passingnowwould add a clock argument to every read API for no change in behavior.BloomTokenLoganchor: chose the token's issue time (expires_at - lifetime) rather than an epoch-aligned period. An aligned period would still refuse valid tokens near a boundary.Impact
MAX_STREAMSannounced yet is now aSTREAM_LIMIT_ERROR, as RFC 9000 requires. A compliant peer never sends one.Caused by
fill_intowrote the transport parameters first and then tookbudget - buf.len()for the close, which can underflow (found by reviewer). The quest named feat(qmux)!: a session is one caller-spawned driver that owns its socket #7494, but blame traces both lines to feat(qmux): run qmux in tree on the QUIC stream state machine #6231.delay(found by reviewer)truncated_acked/acked_lenbut leftSend::ackedrefusing offsets past the truncated buffer (found by reviewer)quinn-protoat the fork point, now listed inrs/moq-quic/README.md's carried changes.Alternatives
Bucket::chargeto takenowand refill itself would make the send-side bug unrepresentable. But the receive side'sspendhas nonow, and threading it throughStreamsState::receivedtouches about 50 test call sites that sibling audit quests are editing too.Validation
cargo nextest run -p moq-quic: 804 passed.oversized_lengths_are_rejectedpasses on 64-bit hosts too: it only guards the 32-bit path, and no 32-bit target is installed locally to run it.delay(MTU probes, off-pathPATH_RESPONSE) over-credit at most one packet per idle stretch, which no deterministic test isolates without new test-only hooks.just checkpasses.Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 06a3dcd
Base: origin/main at fa55b13
Risk: medium,
If a fix is wrong, it could break QUIC connections, stream flow control, CID retirement, or address-validation tokens for peers and users of the published moq-quic crate, but the API and wire format are unchanged and a patch release or revert undoes it, so this is medium rather than high (not on the RISK.md high list, which names release and auth paths). Low would not fit because the change alters shipped runtime behavior, and the quest plan deletion is the only low part.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
cce4a1b6-e107-4a29-8326-9369dbb5b751Risk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a219dd-8d89-7fe2-8559-c675bc49ac09, round 3Score: 10/10,
CID expiry checks preserve their sequence boundaries and no longer scan retired sequence gaps, so the head is ready to land.Rounds: 3; first round 1 (medium 1); findings 2 (medium 2): fixed 2, refuted 0, open 0
Findings: none
The last round's findings, at e464ac8:
rs/moq-quic/src/connection/cid_state.rs:144:Bound expiry pruning work to active CIDs;At `rs/moq-quic/src/connection/cid_state.rs:146`, `forget_retired` checks the batch range against `active_seq`, so gaps left by retired IDs no longer increase pruning work.