Skip to content

fix(qmux): return receive credit and flush application close - #412

Closed
kixelated wants to merge 2 commits into
mainfrom
codex/qmux-credit
Closed

kixelated wants to merge 2 commits into
mainfrom
codex/qmux-credit

Conversation

@kixelated

@kixelated kixelated commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Dropping unread receive streams leaks MAX_DATA credit. Removing STOP_SENDING state also loses later STREAM bytes and RESET final-size gaps. A local close during an in-flight write cancels that write before APPLICATION_CLOSE reaches the peer.

Approach

Close delivery before draining unread buffers, account stopped streams until peer FIN/RESET, and register receive state before exposing an accepted stream. Share stream-count ownership with the backend so retained accounting stays bounded. Drain and flush the first requested close before teardown, with a one-second deadline covering the in-flight write and transport close.

Impact

  • Public API: no signatures, exports, or dependency requirements changed.
  • Wire format: unchanged. Correct MAX_DATA replenishment and APPLICATION_CLOSE delivery; MAX_STREAMS waits for both application drop and peer termination.

Validation

  • Reproduced unread-drop, late-data/reset-gap, and close-mid-write failures before fixing them.
  • cargo test -p qmux --all-features: 152 unit tests, 34 integration tests, and 3 doctests passed using MoQ's pinned Nix toolchain.
  • Final focused Clippy (cargo clippy -p qmux --all-targets --all-features -- -D warnings) and workspace native check/Clippy passed. Full just check with MoQ's newer Clippy stopped on an existing chunks_exact_to_as_chunks lint in the WASM harness; validation with this repository's own pinned Rust 1.94 toolchain and CI are pending.
  • New tests use paused Tokio time and are included in the existing CI test recipe.

Alternatives

Retiring receive accounting at STOP_SENDING cannot account the peer's final size. Immediate teardown cannot reliably deliver a close frame during a pending write.

Follow-ups

Backport #413 targets qmux-v0.5.x. Merge both fixes, and publish patched 0.5.x and 0.6.x releases before updating MoQ's respective pins. This PR does not publish or merge either line.

(written by GPT-6)

Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Source fixes and focused validation are complete on both lines: #412 (0.6) and #413 (0.5). The end-to-end unread-stream and close-delivery regressions both fail on unmodified 0.5.2 and pass with the fixes. Suites pass 189 tests on 0.6 and 181 on 0.5, including doctests; focused Clippy passes on 0.5, and workspace native check/Clippy passed on 0.6 using MoQ's pinned Nix toolchain.

Full checks with web-transport's own pinned Rust 1.94 toolchain and PR CI remain pending. The first broad run with MoQ's newer Clippy failed on the existing WASM harness chunks_exact_to_as_chunks lint. Both PRs remain drafts. No public API or wire-format changes.

MoQ progress is tracked in moq-dev/moq#4705. The remaining blocker is maintainer review/merge and publication of both patched release lines, then MoQ main/dev pin updates. No packages were published and no PRs were merged. Recommendation: finish upstream CI/review, merge/release both lines, then resume the pin steps.

(written by GPT-6)

Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Final sources are pushed: #412 at 82527d2 and #413 at 1adcb9c. Complete qmux tests and focused Clippy pass on these sources: 189 tests on 0.6 and 181 on 0.5, including doctests. The last guard preserves the legacy binding's lack of flow control. Both end-to-end regressions fail against unmodified qmux 0.5.2.

The newly published qmux 0.6.2 contains the earlier receive-map lookup fix, not these credit/close fixes. MoQ must consume releases containing #412/#413 after review and merge. Broad checks with web-transport's pinned Rust 1.94 toolchain and latest-head CI remain pending. All PRs remain drafts; no packages were published or PRs merged by this work.

Recommendation: complete upstream checks/review, merge/release both lines, then resume MoQ main/dev pin updates tracked in moq-dev/moq#4705. No unresolved API or wire choices.

(written by GPT-6)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Closing: QMux development has moved to moq-dev/moq. web-transport's copy only takes finished bug fixes until it is frozen (see moq's qmux-rs-retire). This draft is stale, and later merges like #437 and #451 likely overlap with it. Any remaining issue belongs in moq-dev/moq's qmux.

(Written by Claude Opus 5.5 with high)

@kixelated kixelated closed this Nov 8, 2026
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