Skip to content

fix(moq-net): a drop poll's change reopens the ordered read gates - #9051

Merged
kixelated merged 2 commits into
mainfrom
fix/ordered-read-wakes
Nov 18, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/ordered-read-wakes

Conversation

@kixelated

@kixelated kixelated commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Since #8910, an ordered reader drop-polls its source on every read. On a resumed subscription that poll reaches the serving cursor's poll_drop, which syncs the window and probes fills on the drop poll's own waiter. It can move the window, ask a fill, or hear a fill's answer, and each of those changes what the cursor's group read walks (lowest_wanted, has_filled, is_waiting, the window revision).

Nothing reopened the cursor's read gate for that, and a disarm alone would not have helped: the resume and ordered gates parked on the cursor's gate, and a gate answers Pending again until a wake reaches it. A silent disarm never sends one, so the reader parks for good on a group that is already servable.

Seen as an HLS export over a relay under concurrent load: renditions intermittently never produced a first segment. The export's checks failed in every full run at a pin past #8910 (5 of 5) and passed before it. A lost-wake probe placed on the gates showed the stuck readers parked on an ordered gate whose cursor had changed under the drop poll. A unit-level reproduction of the composite resume path was not found, so the cursor change is validated end to end; the gate behavior has its own unit test.

Approach

  • Idle::reopen disarms like Idle::disarm and also wakes through the gate's own waiter, so every gate the read nests in reads through again, as does the task.
  • Cursor::poll_drop snapshots the window revision and the fill view before it syncs and probes, and reopens the read gate when either changed.
  • Plain disarm stays silent: its other callers (a retired group machine in the publisher, a frame read, the servable update) disarm inside or alongside the read, where a wake would only cost spurious polls.

Impact

  • No public API or wire change.

Alternatives

  • Make every disarm wake: also fixes it, but wakes the publisher's and group reader's hot paths on every retire and frame read (over a thousand extra wakes in one run).
  • Only make disarm wake, without the drop poll reopening the read gate: one end-to-end run still failed, since nothing disarmed the gate the probe changed.
  • Revert feat(net)!: an ordered track reports the groups it gives up on #8910's per-read drop poll: loses gap reporting for ordered tracks.

Validation

  • cargo nextest run -p moq-net --features async: 4093 passed.
  • just ci: passed.
  • End to end, the HLS export suite on a relay built at this change: 237 of 237 checks passed on three runs (two with an earlier variant that woke on every disarm, one with this one).
  • quest review --harness codex (gpt-6.1-sol, high): no findings.
  • Pullfrog's doc finding (module doc named only disarm) fixed in ff79f88; doc-only, reviewed again with no findings.

Caused by

  • moq-dev/moq#8910 - added the per-read drop poll, whose cursor changes never reopened the read gate (found by check: the HLS export suite failed 5 of 5 past it, passed before)

Models

Size: XS
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, XS, arm B)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: ff79f88

  • Base: origin/main at b25a655

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

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

  • Session: 01a1ee70-4a86-7db3-8b13-8c9bdafd5494, round 1

  • Score: 9/10, Source inspection found no actionable defects in the gate reopening and nested wake chain, but runtime behavior remains unverified because builds and tests were not run.

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

  • Findings: none

An ordered reader drop-polls its source on every read since #8910, and on a
resumed subscription that poll reaches the serving cursor's `poll_drop`. That
poll syncs the window and probes fills on its own waiter: it can move the
window, ask a fill, or hear a fill's answer, all of which change what the
cursor's group read walks. Nothing reopened the read gate, and a disarm would
not have helped: the resume and ordered gates parked on the cursor's gate and
answer `Pending` again until a wake reaches them, which a silent disarm never
sends. The reader parks for good on a group that is already servable.

`Idle::reopen` disarms and wakes through the gate's own waiter, so every gate
the read nests in reads again. `Cursor::poll_drop` reopens the read gate when
the window revision or the fill view it walks changed. Plain `disarm` stays
silent for the hot paths that disarm inside or alongside the read.

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

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 732152f7-10b9-41ad-87cf-9044819a0124
Commits

Reviewing files that changed from the base of the PR and between 61f8956 and ff79f88.

Files selected for processing: 3

  • rs/moq-net/src/model/idle.rs
  • rs/moq-net/src/model/track.rs
  • rs/moq-net/src/util/idle.rs
  • 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

@kixelated
kixelated enabled auto-merge November 18, 2026 01:54

@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 blocking issues — one doc line to bring in line with the new API.

Approach: right layer and right shape. The silent mutator (poll_drop's sync/probe, running on its own waiter) reopens the gate it changed and leaves every in-read disarm silent, which keeps the early-exit path intact for the entities that disarm from inside a read.

Reviewed changes — full read of all three files, plus resume.rs's gate chain, miss.rs, record.rs, and kio::Park::hold to check the wake chain and the snapshot's completeness.

  • Idle::reopen (util/idle.rs) disarms and then wakes through the gate's own Woken, so the wake forwards to the waker the gate parked with — the outer gate's waiter, ultimately the task — and every gate in the nest reads through again. New unit test builds a two-gate nest and asserts disarm leaves the outer gate parked and the task unwoken while reopen unparks both.
  • Cursor::poll_drop snapshot (model/track.rs) compares (filter.revision, fill_view()) across the sync/probe and reopens when either moved. I traced both halves: sync/look_up bump the revision on every window move (including the refused arm), and every fill mutation probe can make (judge/ask/resolve/expire/retain) shows up in wanted/filled.
  • Cursor::fill_view maps a still-None misses to the empty view, so a probe that only creates an empty Misses does not force a reopen.
  • Doc (model/idle.rs) covers the outside-the-read reopen case.

Validation I ran here: cargo test -p moq-net --lib --features async (3515 passed, 36 ignored), the idle:: slice (4 passed, new test included), cargo check -p moq-net --no-default-features, and rustfmt --check on the three files — all clean.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash | 𝕏

Comment thread rs/moq-net/src/util/idle.rs Resolved
@moq-bot
moq-bot Bot disabled auto-merge November 18, 2026 01:59
@moq-bot

moq-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

quest land watch: ended this pull request's pick, disarming its auto-merge, since its head 25faf8b is held by finding by pullfrog[bot]: The module doc at the top of this file (lines 8-9) still says a change that notifies nothing "has to Idle::disarm the (#9051 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again.

(written by quest land watch)

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

@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.

Reviewed changes — the one commit since the prior Pullfrog review.

  • Module doc (util/idle.rs) now names Idle::reopen beside Idle::disarm for a change made outside the read. That addresses the earlier doc nit.

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

@kixelated

Copy link
Copy Markdown
Collaborator Author

Decisions from the maintainer:

  • ✅ Merge.
  • ❌ Keep the resume-path unit test follow-up (dropped: the end-to-end HLS run already covers that path). Removed from the body.

(Written by Claude Opus 5.5 with high)

@kixelated
kixelated added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 78ccbbf Nov 18, 2026
9 checks passed
@kixelated
kixelated deleted the fix/ordered-read-wakes branch November 18, 2026 11:52
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