Skip to content

fix(net): a received group lands with the skip its header passed over - #9300

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/interop-green/ietf-audio-stall
Nov 21, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/interop-green/ietf-audio-stall

Conversation

@kixelated

@kixelated kixelated commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Chromium's moq-transport-22 viewer in just test media --media-cases replacement lost its audio for about 250 to 300 ms at a time, then got it back in a burst, failing audio tone about half the time.

Groups were not late. With timing logs on the JS ietf subscriber, every audio group of a failing run arrived in order and on time (420 groups, none later than 22 ms). But about 1 group in 90 had no Prior Group ID Gap on its first object (5 of 430 in one failing run), and each stall started at one of them. The fixture's audio track keys groups by start time, 20 000 apart. Without the gap, the viewer's ordered reader can't tell that the 19 999 keys below the group were never produced. It waits out its hole budget (about 250 ms) for them and then releases the backlog as one burst.

The relay leaves the gap out because of a race. A lite-07 copy created a received group in one lock, then recorded the starts its GROUP's Previous Start passed over in a second lock. The ietf publisher reads skipped_below(key) when it serves a group. A relay thread serving the copy to the moq-transport viewer could run between those two locks, see the group without its skip, and never name it. Lite viewers don't hit this, since lite-07 can still forward a late skip as SUBSCRIBE_SKIP.

Approach

track::Producer::create_group_at takes the passed-over starts and records them under the same lock that admits the group, like append_group already does for a local producer. The group's creation moves into admit_group, which runs under the caller's lock. That lets the skip and the deferred wake cover every outcome (created, held behind a copy still arriving, or refused). The old code recorded the skip whatever the outcome too. The "GROUP passes over a group that arrived" warning moves into the model with it.

a_received_group_lands_with_its_skip checks this with a waker that reads skipped_below when the received group wakes it. With the old ordering it reads Some(0); now it reads Some(4).

Impact

  • Behavior: a relay serving a lite-07 copy to a moq-transport subscriber names every group's Prior Group ID Gap, so the subscriber's ordered reader no longer stalls on keys that were never produced. No public API or wire change (create_group_at is crate-private).

Validation

  • Reproduced on this host first: just test media --media-cases replacement --media-engines chromium failed 3 of 4 runs on main, with audio tone: replacement moq-transport-22 at 60/80, 70/80, and 72/81.
  • Instrumented the JS ietf subscriber with temporary arrival and Prior Group ID Gap logs (not committed). Before the fix, 5 of 430 mid-stream audio groups arrived without a gap, and each lined up with a stall in the probe's trace. After it, 6 of 6 runs passed with no mid-stream group missing its gap across about 3 800 groups. The only gapless groups left were each subscription's first. Every replacement and fallback stayed under 215 ms against the 1039 ms bound.
  • a_received_group_lands_with_its_skip fails with the old ordering put back (left: Some(0), right: Some(4)) and passes with the fix.
  • The moq-net suite (4143 tests) and just check (10 961 Rust tests plus lints) pass.

Caused by

  • moq-dev/moq#8918 - derives the moq-transport Prior Group ID Gap from the copy's skips when it serves a group, but the lite-07 copy recorded the skip after the group became visible, so the gap could be missing (found by check: the media replacement case)
  • moq-dev/moq#8908 - added the lite-07 Previous Start skip and recorded it after creating the group, in a second lock

Decisions

Made without the maintainer, for review:

  • Fixed it at the source, one lock for the group and its skip, rather than having the ietf publisher read the gap later (when it writes the first object). Reading later only narrows the window, and a skip that comes on its own (a lite-07 SUBSCRIBE_SKIP after its group) still has no moq-transport message to carry it.
  • Moved the "GROUP passes over a group that arrived" warning from the lite subscriber into track::Producer, since the contradiction is only known inside the lock now.

Follow-ups

None. Related open work: moq-dev/moq#9291 (joining FETCH) also targets Interop's red runs. This change doesn't overlap it or moq-dev/moq#9265.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort (arm B)

(Written by Claude Opus 5.5 with high)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: 91190b7

  • Base: origin/main at 4ce2fca

  • Risk: medium, The change alters group admission and skip visibility, so a regression could stall media delivery for relay subscribers, but it preserves public APIs and wire formats and a revert fully undoes it.

  • Classified: medium by Codex, gpt-6.1-sol, low effort, session 01a1fe23-0731-7192-98b0-265c521c6c92

  • Reviewer: Codex, gpt-6.1-sol, high effort

  • Session: 01a1fe23-253b-75f0-8e00-9a64ceff53e8, round 1

  • Score: 9/10, The focused shared-lock fix resolves the group/skip ordering race with a deterministic regression test and no actionable static-review findings, though builds and tests were not run as instructed.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 21, 2026 04:16
A lite-07 copy created a received group, then recorded the starts its
GROUP's Previous Start passed over in a second lock. A relay serving the
copy to a moq-transport viewer on another thread could serve the group in
between, so its first object went out without a Prior Group ID Gap, and
the viewer's ordered reader waited out its hole budget (about 250 ms of
silent audio) for keys that never come.

track::Producer::create_group_at now takes the passed-over starts and
records them under the same lock that admits the group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Chromium's moq-transport audio keeps its tone through the replacement case fix(net): a received group lands with the skip its header passed over Nov 21, 2026
@kixelated
kixelated marked this pull request as ready for review November 21, 2026 12:47

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: sound. The fix records the Previous Start skip and admits the group under the same track lock, so no reader can see the group without its skip. That matches append_key for local producers and fixes the cause, not the timing window.

Reviewed changes

I reviewed all five files at 91190b7, traced the new admission order through TrackState::skip_groups and admit_group, and checked the ietf publisher's single skipped_below read and the lite publisher's held-skip handling.

  • Skip and admission under one lock: create_group_inner now calls skip_groups(passed) and charge_debt() before admit_group. passed is strictly below info.start (passed_over returns empty when previous >= start), so the skip can't refuse the group with Error::Skipped. The skip is still recorded for every outcome — created, held, or refused — as it was before.
  • admit_group split: settle_head and deferred.wake() now run after the lock drops for every outcome, including Held and errors. This keeps the earlier lock order (track, then group).
  • Warning moved into the model: cached is the set of lookup keys in passed. That gives the same result as the old post-create skip_received call, because the new group's key is never in passed.
  • Lite publisher unaffected: existing tests such as lite07_sends_a_held_skip_when_its_group_is_dropped already record a skip before its group becomes visible. A skip and its GROUP arriving together still hold the skip back for the GROUP's Previous Start.
  • Regression test: a_received_group_lands_with_its_skip reads skipped_below(9) from the wake that the group's admission triggers, so it pins the visibility order directly.

ℹ️ moq-transport ingest still shows a group before its Prior Group ID Gap

On a moq-transport upstream, the relay creates the group in OpenGroup::poll. The skip is recorded later, in GroupIngest::skip_prior, when the first object's size is parsed. The ietf publisher reads skipped_below only once, in GroupServe::new. So a third-party moq-transport publisher → relay → moq-transport viewer path has the same gapless-first-object window this PR closes for lite-07. This PR doesn't introduce it, and the path matters only for third-party publishers, so it can be a follow-up. On that path, re-reading the gap when the first object is written closes the window, because the upstream's first object (which records the skip) must land before the relay can forward it.

Technical details
# moq-transport ingest: group visible before its Prior Group ID Gap

## Affected sites
- rs/moq-net/src/ietf/subscriber.rs:6557 — `OpenGroup::poll` returns `create(track)?` (group visible) after peeking the first object.
- rs/moq-net/src/ietf/subscriber.rs:8349 — `GroupIngest::header` → `skip_prior` → `track.skip_received(start..key)` runs only once the first object's size is decoded.
- rs/moq-net/src/ietf/publisher.rs:6997 — `self.track.skipped_below(key)` is read once at `GroupServe` construction and fixed via `.gapped(gap)`.

## Required outcome
- A relay serving a moq-transport-ingested copy to a moq-transport subscriber names the Prior Group ID Gap on the group's first object whenever the upstream's first object carried one.

## Suggested approach (optional)
- Either have `GroupServe` re-read `skipped_below(key)` when it writes the first object (by then the upstream's first object, and so its `skip_prior`, has landed), or pass the peeked first object's gap into group creation so it is recorded under the same lock, as this PR does for lite-07.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Group creation now accepts a passed-over key range and records nonempty ranges before admitting a received group. The subscriber passes the header’s range when it opens a group, and reopens with an empty range. Tests cover a waiting reader observing preceding skipped keys and update existing calls to pass empty ranges. The README now describes the replacement-join gap, and the related issue note is deleted.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 91190

The change records the skipped groups under the same lock that admits a received group, so a relay no longer sends a group without its gap. No concrete merge-blocking risk was found, and the PR reports passing tests.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: a received group is recorded together with the skip its header passed over. It matches the track.rs and subscriber.rs changes that move passed-over range recording un…
Description check Passed The description explains the problem, the race between two locks, the approach of recording passed-over starts under the admitting lock, the validation, and the related PRs. It matches the changes to …
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.
Full details: Title check

Explanation

The title states the main change: a received group is recorded together with the skip its header passed over. It matches the track.rs and subscriber.rs changes that move passed-over range recording under the group admission lock. The title is specific and concise, and it has no file lists or vague terms.

Full details: Description check

Explanation

The description explains the problem, the race between two locks, the approach of recording passed-over starts under the admitting lock, the validation, and the related PRs. It matches the changes to create_group_at, admit_group, the warning move, and the new regression test. It is related to the changeset in detail.

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

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: c97867ca-f939-4f05-91f0-2b851f541e44
Commits

Reviewing files that changed from the base of the PR and between 4ce2fca and 91190b7.

Files selected for processing: 5

  • quest/m0/interop-green/README.md
  • quest/m0/interop-green/ietf-audio-stall.md
  • rs/moq-net/src/lite/subscriber.rs
  • rs/moq-net/src/model/resume.rs
  • rs/moq-net/src/model/track.rs
Files with no reviewable changes: 1

  • quest/m0/interop-green/ietf-audio-stall.md

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

@kixelated
kixelated added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit ec3dfaf Nov 21, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/interop-green/ietf-audio-stall branch November 21, 2026 15:25
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