Repository navigation
fix(net): a received group lands with the skip its header passed over - #9300
Conversation
Quest-Claim: 5cf2a210d39a63aa
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>
There was a problem hiding this comment.
✅ 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_innernow callsskip_groups(passed)andcharge_debt()beforeadmit_group.passedis strictly belowinfo.start(passed_overreturns empty whenprevious >= start), so the skip can't refuse the group withError::Skipped. The skip is still recorded for every outcome — created, held, or refused — as it was before. admit_groupsplit:settle_headanddeferred.wake()now run after the lock drops for every outcome, includingHeldand errors. This keeps the earlier lock order (track, then group).- Warning moved into the model:
cachedis the set oflookupkeys inpassed. That gives the same result as the old post-createskip_receivedcall, because the new group's key is never inpassed. - Lite publisher unaffected: existing tests such as
lite07_sends_a_held_skip_when_its_group_is_droppedalready 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_skipreadsskipped_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.claude-opus-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughGroup 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:
|

Problem
Chromium's
moq-transport-22viewer injust test media --media-cases replacementlost its audio for about 250 to 300 ms at a time, then got it back in a burst, failingaudio toneabout 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_attakes the passed-over starts and records them under the same lock that admits the group, likeappend_groupalready does for a local producer. The group's creation moves intoadmit_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_skipchecks this with a waker that readsskipped_belowwhen the received group wakes it. With the old ordering it readsSome(0); now it readsSome(4).Impact
create_group_atis crate-private).Validation
just test media --media-cases replacement --media-engines chromiumfailed 3 of 4 runs onmain, withaudio tone: replacement moq-transport-22at 60/80, 70/80, and 72/81.a_received_group_lands_with_its_skipfails with the old ordering put back (left: Some(0), right: Some(4)) and passes with the fix.moq-netsuite (4143 tests) andjust check(10 961 Rust tests plus lints) pass.Caused by
replacementcase)Decisions
Made without the maintainer, for review:
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 reviewafter 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-265c521c6c92Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1fe23-253b-75f0-8e00-9a64ceff53e8, round 1Score: 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