Skip to content

fix(net): judge a live join's answer by the budget it was recorded under - #9734

Closed
kixelated wants to merge 1 commit into
mainfrom
fix/lite07-join-answer-budget
Closed

kixelated wants to merge 1 commit into
mainfrom
fix/lite07-join-answer-budget

Conversation

@kixelated

@kixelated kixelated commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A copy that answered a lite-07 live join before a retune wider never probes for the wider budget, so its readers wait forever.

The sequence:

  1. The copy subscribes with a live join at max = 0 and records the publisher's SUBSCRIBE_START as the join's answer: a tick plus the budget it was asked under (0).
  2. The reader retunes the range to max = 100ms before it is placed.
  3. joinProbes only checks that the answer's tick is newer than join.since, then compares min(asked, now) >= join.budget. joinBudgets stops recording once a range is answered, so asked is unbounded and now is the new 100 ms max. The probe is skipped.
  4. The track places a reader only when answer.budget >= reader.budget (track.ts / TrackState::join_answer). An answer recorded under 0 never places a 100 ms reader, so the ordered read holds every group forever.

JS and Rust have the same bug. A browser player stalls with zero frames even though the relay keeps serving groups. In an end-to-end suite where a page subscribes and then raises its max age, this hit roughly 1 in 4 runs.

Approach

Store the budget next to the tick when a join is answered (JoinAnswered { tick, budget }, replacing join_ticks/joinTicks). An answered range answers a join only if both hold:

  • its tick is newer than join.since;
  • the budget it was answered under covers join.budget.

This is the same predicate the track uses to place a reader, so the subscriber probes exactly when the track would refuse the answer. The unanswered branch is unchanged.

Validation

  • New unit test on each side, a join answered before a retune wider is probed (JS) and a_join_answered_before_a_retune_wider_is_probed (Rust). Both fail on main ("an answer recorded under max 0 places no reader at 100 ms") and pass here.
  • just check: everything except test js passes, including the Rust suite (11656 tests) and all @moq/net tests (3959 pass, 0 fail). test js reports one unhandled error between tests from copy_fill.test.ts:66. That is a pre-existing flake: 3 of 16 runs on main's subscriber.ts, and 1 of 8 with this change.
  • With this patch, a downstream browser e2e suite that subscribes and retunes went from 3–4 stalls per 12–18 runs to 36/36 passes.

Impact

No public API or wire change. Behavior: the copy now sends a probe range in the retune-wider-after-answer case, where it used to send nothing.

Caused by

  • moq-dev/moq#9409 - gated join answers on budget, but its answered branch compares against the range's current max instead of the budget the answer was recorded under (found by check: a downstream e2e flake)

Follow-ups

  • js/net/src/lite/copy_fill.test.ts:66 throws expected a value from defined(group) between tests in about 1 of 6 runs on main. Its fill loop's fill.accept(key) can return nothing after the test closes.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

A copy's update loop decided whether a demand range already placed a reader's live
join from the max it last recorded asking plus the range's current max. A range
answered before any update never had its first max recorded, so once retuned wider
the loop took an answer recorded under the narrower max as placing the wider
reader, sent no probe, and the track (which places by the recorded budget) left
the reader waiting for good. Record each answer's budget beside its tick and judge
by it, as the track does.

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

coderabbitai Bot commented Nov 27, 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 4 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: 282251ae-25ab-493f-874e-9b211073e758
Commits

Reviewing files that changed from the base of the PR and between f7d79c3 and 339179b.

Files selected for processing: 3

  • js/net/src/lite/subscriber.test.ts
  • js/net/src/lite/subscriber.ts
  • rs/moq-net/src/lite/subscriber.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

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate of #9735, which fixes the same bug: an answer recorded under max 0, then a retune wider, so no probe is sent. It does so with a smaller change, by keeping the answered budget in join_budgets/joinBudgets. I re-ran the downstream browser e2e repro against #9735's head 16d6ddd: 36 of 36 passed, the same as with this branch.

(Written by Claude Opus 5.5)

@kixelated kixelated closed this Nov 27, 2026
@kixelated
kixelated deleted the fix/lite07-join-answer-budget branch November 27, 2026 02:39
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