Skip to content

fix(net): open SUBSCRIBE_TRACKS PUBLISHes only as stream credit admits - #6641

Merged
kixelated merged 4 commits into
mainfrom
quest/m1/listing-credit
Oct 24, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m1/listing-credit

Conversation

@kixelated

@kixelated kixelated commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Quest: SUBSCRIBE_TRACKS listings follow stream credit (deleted here, since this finishes it).

Summary

A draft-18+ SUBSCRIBE_TRACKS listing used to start a PUBLISH task for every track as soon as it read the track. Each task held a subscription slot, a track handle, and a draft-18 claim, and waited on stream credit. A peer that withheld credit therefore made the session hold one task per catalog track, for every peer. The only bound was Limits::requests, a runtime cap, and tracks past it were skipped.

Now, in rs/moq-net/src/ietf/publisher/tracks.rs:

  • FORWARD=0: each broadcast stages one track at a time and opens its PUBLISH stream only once the peer's credit admits it (Stream::poll_open inside the broadcast's wait). The PUBLISHes a peer holds are therefore bounded by the credit it grants. The listing keeps being read meanwhile, because an unlisted track's PUBLISH_DONE is what returns credit; stopping the reads could deadlock a peer whose credit is all held by PUBLISHes of removed tracks. Tracks read but not yet PUBLISHed sit in a per-broadcast pending map. Each entry is moved out of the listing's own queue, not copied, so this costs no more than leaving the track unread. Skip checks (properties this draft can't describe, the draft-18 duplicate claim) run as a track is staged, so a stream is only opened for a PUBLISH that actually goes out.
  • FORWARD=1: with no PUBLISHes there's nothing to unlist, so the listing reads its next track only once the request stream has taken the last skip. A peer that stops reading leaves one skip queued, and the rest stay unread in the listing.
  • The listing no longer uses Limits::requests. The IETF subscriptions slots are counted only for the subscriptions_peak stat (Slots::default()), and a PUBLISH takes hold() once its stream opens.

Tests, swept over catalog sizes 4, 64, and 512 so any per-table cost would show up as a slope:

  • a_listing_publishes_only_as_credit_admits (drafts 18 to 22): a peer with 2 bidi streams of credit that reads nothing holds exactly 2 PUBLISHes. Once it refuses each one, every track is PUBLISHed exactly once and the count never goes above 2. On the old code it holds 4 (the whole catalog).
  • a_forwarding_listing_reads_only_as_skips_go_out (drafts 19 and 22): exactly one skip is queued until it is taken, and then each track is skipped once. On the old code all 4 are queued at once.
  • Removed past_the_request_limit_a_track_is_skipped, which only exercised the removed cap.

Docs: Limits::requests rustdoc, doc/bin/relay/config.md, and doc/concept/standard.md (Rust paces by credit, JS still caps). Pacing the JS listing the same way is a new m1 quest, JS SUBSCRIBE_TRACKS follows credit, so this PR no longer edits quest/m1/js-qmux-credit.md, which moq-dev/moq#6644 finishes and deletes.

Choices made without asking

  1. The FORWARD=0 listing keeps reading while it waits on credit, rather than stopping outright, to avoid the removal deadlock above. What it holds per unread track is the listing queue entry it moved, so the per-listing floor is still the model's own Tracks queue, which holds the live set for every reader. Getting below that floor would mean changing the model's listing to a cursor, which I left out of scope.
  2. If a PUBLISH stream fails to open (the session is closing), that broadcast's listing ends instead of retrying.
  3. The JS mirror is its own quest instead of being done here. @moq/net keeps its listing cap until that quest lands on top of the @moq/qmux credit fix.

Public API and wire impact

  • Public API: none. Limits::requests stays, and its doc drops the listing bound.
  • Wire: none. Behavior: past the old requests cap, a track now waits for stream credit instead of getting PUBLISH_SKIPPED (PUBLISH_BLOCKED on draft 18).

Checks

  • just check: pass.
  • just test interop --all: pass.
  • The new tests fail on the previous implementation and pass on this one.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

kixelated and others added 2 commits October 24, 2026 08:14
Quest-Claim: 8fc5ec92fb0be442
A listing spawned a PUBLISH task per track as it enumerated, each waiting on
stream credit, so a peer that withheld credit made the session hold one task
per catalog track, bounded only by `Limits::requests`. Each broadcast now
stages one track at a time and opens its stream only once credit admits it,
reading the listing meanwhile so removals still end PUBLISHes and return
credit. A FORWARD=1 listing reads its next track only once the request stream
took the last skip. The listing no longer uses `Limits::requests`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title SUBSCRIBE_TRACKS listings follow stream credit fix(net): open SUBSCRIBE_TRACKS PUBLISHes only as stream credit admits Oct 24, 2026
@kixelated
kixelated marked this pull request as ready for review October 24, 2026 16:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T16:24:03.513717Z 0a2a446 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 975bc2fd-418c-4e25-8339-3864fc418826
Commits

Reviewing files that changed from the base of the PR and between ea4a644 and 555c738.

Files selected for processing: 9
  • doc/bin/relay/config.md
  • doc/concept/standard.md
  • quest/m1/README.md
  • quest/m1/js-qmux-credit.md
  • quest/m1/listing-credit.md
  • rs/moq-net/src/ietf/publisher.rs
  • rs/moq-net/src/ietf/publisher/tracks.rs
  • rs/moq-net/src/ietf/session.rs
  • rs/moq-net/src/session.rs
Files with no reviewable changes: 2
  • quest/m1/README.md
  • quest/m1/listing-credit.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

Walkthrough

The Rust publisher now stages listed tracks and opens PUBLISH streams as peer stream credit becomes available. Subscription slots no longer use limits.requests as their capacity. FORWARD=1 listing reads wait until the queued skip leaves the request stream. Cleanup updates pending, staged, listed, and skipped entries. Tests cover credit-bounded PUBLISH creation and skip queuing. Documentation distinguishes Rust and JavaScript handling and updates the related limits descriptions.

Priority: Normal

Merge Risk: Minimal · up to 555c7

No merge-blocking issue was established; the older-draft request limit remains enforced. The change is ready for normal merge checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "fix(net): open SUBSCRIBE_TRACKS PUBLISHes only as stream credit admits" names the main change: PUBLISH streams for draft-18+ SUBSCRIBE_TRACKS listings are now opened according to peer strea…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (4 skipped: 3 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The PR description is specific and on-topic. It names the changed file (rs/moq-net/src/ietf/publisher/tracks.rs), explains the problem (one PUBLISH task per listed track, each holding a subscription s…
Full details: Title check

Explanation

The title "fix(net): open SUBSCRIBE_TRACKS PUBLISHes only as stream credit admits" names the main change: PUBLISH streams for draft-18+ SUBSCRIBE_TRACKS listings are now opened according to peer stream credit instead of per-track tasks capped by Limits::requests. It is specific, single-sentence, and matches the summary and objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (4 skipped: 3 unsupported, 1 too large.)

Full details: Description check

Explanation

The PR description is specific and on-topic. It names the changed file (rs/moq-net/src/ietf/publisher/tracks.rs), explains the problem (one PUBLISH task per listed track, each holding a subscription slot and waiting on stream credit) and the fix (FORWARD=0 staging gated by stream credit, FORWARD=1 reading paced by skip consumption). It also lists the docs touched, the tests added and removed, and the public API and wire impact. This matches the changeset summaries, which cover tracks.rs, session.rs, publisher.rs, the Limits::requests docs, the relay config doc, the standard doc, and the quest files.

Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

kixelated and others added 2 commits October 24, 2026 09:17
#6644 finishes and deletes js-qmux-credit.md, so the JS listing pacing
lives in quest/m1/js-listing-credit.md instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging head 0a2a446: CI green (11/11), Codex reviewed this head with no findings, quest check passes against current main. No changes made during merge; no open decisions.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 2c7274d Oct 24, 2026
11 checks passed
@kixelated
kixelated deleted the quest/m1/listing-credit branch October 24, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant