diff --git a/quest/m1/README.md b/quest/m1/README.md index 3f93058e5c5..c66cc821943 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -120,7 +120,6 @@ removed). - [Resume checked against a model](/quest/m1/resume-model-test.md) - a randomized test checks every resumed reader against a one-track reference model in Rust and JS, and passes before the cut - [Recover by the reader's budget](/quest/m1/recover-reader-budget.md) - resume judges a missing group by each reader's own budget, not the copy's -- [Rust resume release path](/quest/m1/resume-release-rust.md) - letting go of a replaced Rust copy never releases a group already moved to another - [Slow joiner test](/quest/m1/slow-joiner-test.md) - a reader stalled before its first read loses no groups within its budget, under real stream backpressure - [Address groups by timestamp](/quest/m1/time-addressing/README.md) - group start timestamps replace sequence numbers in the moq-net API and lite-07 wire, while old subscribers, old publishers, and published JS clients keep working - [Release audit findings](/quest/m1/release-audit/README.md) - resolve newly identified resource, parser, playback, and interoperability risks before the cut diff --git a/quest/m1/resume-release-rust.md b/quest/m1/resume-release-rust.md deleted file mode 100644 index 0cb835b83c5..00000000000 --- a/quest/m1/resume-release-rust.md +++ /dev/null @@ -1,16 +0,0 @@ -# [S] Rust resume never releases a moved group - -## Goal - -Letting go of a replaced copy in Rust resume never releases a group already -moved to another copy, so that group never ends cleanly with frames missing. -A test proves it either way. - -## Plan - -[moq-dev/moq#6947](https://github.com/moq-dev/moq/pull/6947) fixed this in -`@moq/net`, found by its model test. Rust's sweeps pass, but nobody checked -whether Rust has the same release path. Write the fixed case from that JS -fix against Rust; if it fails, fix it at the cause. - -Public API: none. diff --git a/rs/moq-net/src/model/resume.rs b/rs/moq-net/src/model/resume.rs index 5c5c324445e..d4493e4530b 100644 --- a/rs/moq-net/src/model/resume.rs +++ b/rs/moq-net/src/model/resume.rs @@ -3933,6 +3933,57 @@ mod test { } } + /// A group handed out from a replaced copy, then moved to the serving copy once the + /// replaced route gave it up, reads on to its last frame after that copy is let go, + /// in either read order. + #[test] + #[cfg(feature = "async")] + fn a_moved_group_outlives_the_replaced_copy_it_was_handed_out_from() { + for ordered in [false, true] { + let routes = Producer::new(); + let logical = logical(&routes); + let a = copy(); + routes.serve(a.consume()); + let mut sub = subscribe(&logical, HOUR); + let b = copy(); + let dynamic = b.requests(); + routes.serve(b.consume()); + + // The serving route has nothing yet, so group 8 comes from the replaced one. + let mut open = a.create_group(group::Info { sequence: 8 }).unwrap(); + open.write_frame(ts(8), b"a".as_ref()).unwrap(); + let res = match ordered { + true => sub.poll_next_group(&kio::Waiter::noop()), + false => sub.poll_recv_group(&kio::Waiter::noop()), + }; + let Poll::Ready(Ok(Some(mut reading))) = res else { + panic!("expected group 8"); + }; + assert_eq!(reading.sequence, 8); + assert_eq!(read(&mut reading), Some(b"a".to_vec())); + + // The replaced route gives it up, so the rest is fetched from the serving route. + open.abort(Error::Stream(StreamError::DeliveryTimeout)).unwrap(); + assert!(reading.read_frame().now_or_never().is_none()); + let request = dynamic.requested_fill_group().now_or_never().unwrap().unwrap(); + assert_eq!((request.sequence(), request.frame_start()), (8, 1)); + let mut rest = request.accept(None).unwrap(); + assert!(reading.read_frame().now_or_never().is_none()); + + // The serving copy's first group bounds the replaced one, which is let go. + write(&b, 9); + assert_eq!(drain(&mut sub, ordered), [9]); + assert_eq!(copies(&routes), 1, "ordered={ordered}"); + + rest.write_frame(ts(9), b"b".as_ref()).unwrap(); + rest.write_frame(ts(10), b"c".as_ref()).unwrap(); + rest.finish().unwrap(); + assert_eq!(read(&mut reading), Some(b"b".to_vec()), "ordered={ordered}"); + assert_eq!(read(&mut reading), Some(b"c".to_vec())); + assert_eq!(read(&mut reading), None); + } + } + /// A group the new copy replays, already handed out, does not bound the replaced copy: /// the old route's next group still arrives. #[test]