Repository navigation
fix(net): a far-ahead group sequence costs a relay nothing extra (backport #9044) - #9109
Conversation
…kport #9044) Arrival entries carry their own position, so dead ones are compacted from anywhere once they outnumber the cached groups, and a reader's walk moves past the entries it is never handed (dead, aborted, or below its floor). A lowered floor walks again from the reader's last hand-out, which keeps release's widening-update behavior without main's cache re-offer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fix lands on release in #9109. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No correctness issues found. One stale comment is worth a quick fix.
Approach: sound. With absolute arrival positions, dead entries can be dropped from anywhere, so a protected far-ahead live edge no longer pins the queue. The served rewind keeps release's lowered-floor semantics without porting main's Filter::owed.
Reviewed changes: I reviewed the single commit, which backports the track half of #9044 to release.
- Absolute arrival positions:
arrivalholdsArrived { at, sequence, stamp }, andnext_arrivalreplacesoffset.arrivals_fromfinds a reader's start withpartition_point, which is valid becausepush_backandretainboth keepatsorted. compact_arrival: oncearrivalholds more than2 * lookup.len() + EVICT_SLACKentries, it keeps only the current(sequence, stamp)entries. This runs on each visible push and on each expiry scan. Stamps are unique per incarnation, so at mostlookup.len()entries stay live. The new predicate inexpiry_mutation_dueis therefore false right after a compaction and cannot keep a scan looping.- Cursor advance in
poll_recv_group: the reader'sindexnow moves past every entry it is not handed: dead, aborted, or below its floor. Each of those exclusions is permanent for that stamp, except the floor, which the next bullet handles. So a wake walks only entries that arrived since the last wake. servedrewind: whenSubscriber::start_atlowers the floor, it rewindsindexto one past the last hand-out. The othermin_sequencewriter (maxat the Spliced/start_atraise path) only raises the floor, so it needs no rewind. Groups parked past the cap also setserved, which matches the pre-PR behavior.CACHE_OVERHEAD: the per-group cost now counts oneArrivedhint plus oneevicthint, so the pool bills the larger entry.- Tests: they cover both the bound on the arrival queue and the lowered-floor re-offer without replay.
ℹ️ datagram_offset's comment still names the removed offset
The comment on TrackState::datagram_offset (rs/moq-net/src/model/track.rs:205-206) still ends with "(mirrors offset for groups)". This PR deletes offset, and groups no longer use a pop-count offset at all. I couldn't attach this inline because the line is unchanged context in the diff.
Technical details
# Stale `offset` reference
## Affected sites
- rs/moq-net/src/model/track.rs:205-206: the `datagram_offset` comment says "(mirrors `offset` for groups)", but `offset` was removed in favor of `Arrived.at` / `next_arrival`.
## Required outcome
- The comment no longer names the removed field, for example by dropping the parenthetical.claude-opus-5-5 | 𝕏
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in a42fef3: the (Written by Claude Opus 5.5 with high) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: the one commit since the prior pullfrog review.
- Dropped the stale
offsetreference from thedatagram_offsetcomment inrs/moq-net/src/model/track.rs, which addresses the earlier nit.
claude-sonnet-5-5 | 𝕏
|
Decision from the maintainer:
(Written by Claude Opus 5.5 with high) |

Backport to
releasefor quest/m0/backport-relay-high-key.md: the track half of moq-dev/moq#9044, so it ships in amoq-netpatch in the next release.Problem
A publisher that sends a far-ahead group sequence (say
1<<40) and then keeps publishing below it:arrivalwas trimmed only from the front and the front is the protected live edge;Reproduced on
releasefirst: the new test saw 257 arrival entries for 2 cached groups.Changes
All in
rs/moq-net/src/model/track.rs:Arrived { at, sequence, stamp }), withnext_arrivalreplacingoffset.compact_arrivaldrops dead entries from anywhere once the queue holds more than2 * cached + EVICT_SLACK, the ruleevictalready uses, on each push and each expiry scan.poll_recv_groupmoves the reader's walk position past entries it is never handed: dead, aborted, or below its floor.PlainSubscribergainsserved, one past the last position handed out, andstart_atlowering the floor rewinds the walk to it.mainre-offers a lowered floor's groups from the cache (Filter::owed);releasehas no such path and instead relied on the cursor staying put, whicha_widening_update_serves_the_finished_group_it_had_skippedtests. Without the rewind, that test fails (checked by deleting the line).The front's track-info cleanup from #9044 stays on
main, per the quest.Impact
Decisions
servedrewind above is the one change beyond fix(net): a far-ahead group key costs a relay nothing extra #9044, so this stops at ready for the maintainer instead of landing on its own. Alternative considered: move the cursor only past dead entries, which keeps the memory fix but leaves each wake walking every cached below-floor group.mainhands a cut group out;releaseskips aborted ones, and an abort is permanent for a stamp).Validation
a_far_ahead_sequence_pins_nothing_behind_it(new): fails onrelease(257 entries for 2 cached groups) and passes here, with the reader's walk position at the queue's end.a_lowered_floor_serves_a_group_the_reader_passed(new): a passed below-floor group is served after the floor drops, and a handed-out one is not replayed. Removing the rewind fails it anda_widening_update_serves_the_finished_group_it_had_skipped.main'strack_high_keybench, adapted torelease's API (set_groups(HIGH..),group::Info { sequence }) and run locally, not committed (bench-only backports are their own PRs). Time per write:release, 1rrelease, 8rrelease, 64rreleasegrows with every iteration, so its points are all far up the slope; this PR is flat in the backlog and linear in readers.just checkpasses (5200 Rust tests).Caused by
offset, which can't drop entries behind a live front (found by an audit).Models
Size: M
Implementer: Claude Code, claude-opus-5-5, high effort (arm A)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high)
Review
Rewritten by
quest reviewafter each round.Head: a42fef3
Base: origin/release at c636e03
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1f055-8e79-75a2-9316-2da5a943bfca, round 2Score: 9/10,
The only incremental change removes an outdated comment reference and introduces no actionable regressions; builds and tests were not run as instructed.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none