net: a replaced copy let go with its track open loses a group it gave up under the resume point
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- distributed-systems
Research direction
Start with rs/moq-net/src/model/resume.rs and reproduce the failure using the supplied test in mod test, checking why asked_for(&b, 2) is false. Then read Reader::owed and how it handles replaced copies and runs they can still deliver. Done means the fill for group 2 is retained and the supplied scenario passes without breaking the three named regression tests.
Written by the indexing model from the issue text.
Description
A logical reader can lose a group under the serving copy's resume point after a route switch, when a replaced copy gives that group up and is then let go while its track stays open.
Scenario
- Route A's copy holds groups 0, 1 and 4. The reader reads them, then the front switches to route B, whose live feed starts at 4 (so 2 and 3 can come from B only as fills).
- A drops group 2, while group 3 may still land on it.
Reader::owedsubtracts A's whole fed span (copy.replaced && !copy.fills && copy.feeds), so no fill is kept for 2 either. - A then skips group 3 while its track stays open. Nothing is left to land on A, so
Copy::retainsreturnsNoandlet_godrops it. ran_shortre-arms the serving route's walk only whenpoll_firstsees the copy end cleanly (done = Some(Ok)), which never happens here.gave_upcovers onlydrains. Nothing asks B for group 2, and an ordered read waits at it.
This affects bounded and unbounded reads alike. On main it predates moq-dev/moq#10176, which only widened owed and ran_short to unbounded reads.
Reproduction
Add this to rs/moq-net/src/model/resume.rs's mod test. It fails at asked_for(&b, 2):
/// A replaced copy let go while its track stays open, after giving up one group the reader
/// lacks and having the rest it still fed skipped, leaves that group to the serving route:
/// no fill was kept for what it still fed.
#[test]
fn a_replaced_copy_let_go_open_has_a_group_it_gave_up_asked_again() {
let routes = Producer::new();
let logical = logical(&routes);
let a = received_copy();
routes.serve(a.consume());
let mut sub = subscribe_until(&logical, 6);
for key in [0, 1, 4] {
write(&a, key);
}
let mut got = drain(&mut sub, false);
got.sort_unstable();
assert_eq!(got, [0, 1, 4]);
let mut b = received_copy();
routes.serve(b.consume());
// Its live feed starts at the resume point, so 2 comes only as a fill.
b.start_at(4).unwrap();
write(&b, 5);
assert_eq!(drain(&mut sub, false), [5]);
// The old route gives 2 up while 3 may still land on it.
a.drop_groups(2..3);
assert!(sub.poll_recv_group(&fresh()).is_pending());
// Then it skips 3, its track still open, so nothing is left to land on it.
a.skip_groups(3..4);
assert!(sub.poll_recv_group(&fresh()).is_pending());
assert!(sub.poll_recv_group(&fresh()).is_pending());
assert!(asked_for(&b, 2), "{:?}", b.subscription());
write(&b, 2);
assert_eq!(drain(&mut sub, false), [2]);
}
What a fix has to keep
The obvious fix re-arms Resumed::Route whenever let_go drops a copy that still fed a group the reader lacks under the resume point. That over-asks: it breaks a_kept_out_key_above_a_finished_backfill_is_asked_from_itself (a copy let go past the budget gets asked again), and even limited to copies within their budget it breaks an_unplaced_time_start_waits_on_a_replaced_copy and ..._only_to_its_end (the serving route gets asked for history those tests leave unasked). The reviewer's suggestion is narrower: in Reader::owed, subtract only the runs the replaced copy can still deliver (not its drops), so the fill for group 2 is kept.
Found by Codex review on moq-dev/moq#10176.
(Written by Claude Opus 5.5)
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 251
- Avg merge
- 10h 10m
- Merged PRs (30d)
- 822
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moq-dev/moq
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
moq-dev/moq#10463 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
moq-dev/moq#10460 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
quest
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
moq-dev/moq#10373 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
quest
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
moq-dev/moq#10336 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
lbjlaq/Antigravity-Manager#4180 ·
Maintainers usually reply within 1 day
-
bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zizmorcore/zizmor#2608 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
longbridge/nsh#4201 ·
Maintainers usually reply within 1 day