From 5d8c345baf4d668004477a292f1c75c697698ab5 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 20:21:31 -0800 Subject: [PATCH 1/5] chore(quest): claim quest/m0/test-flakes-2/gst-stale-completion.md Quest-Claim: a327977d8a8ea43f From 1d0e21f977eb615e39d441d7ec72a6ff9455771a Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 20:42:09 -0800 Subject: [PATCH 2/5] fix(moq-gst): a local stop never fails the sink's publication Session::stop aborts the status task before the reconnect loop, but an abort cannot cancel a poll already in flight. When the task's first poll after registration overlaps the stop, it sees the loop's end and fails its own completion. The task now returns quietly on moq_tokio's Error::Stopped, which only a local stop produces. Unquarantines a_stale_completion_cannot_end_the_next_publication. Co-Authored-By: Claude Opus 5.5 --- quest/m0/test-flakes-2/README.md | 1 - .../m0/test-flakes-2/gst-stale-completion.md | 29 ------------------- rs/moq-gst/src/sink/imp.rs | 1 - rs/moq-gst/src/sink/session.rs | 24 ++++++++++++++- 4 files changed, 23 insertions(+), 32 deletions(-) delete mode 100644 quest/m0/test-flakes-2/gst-stale-completion.md diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index 381c52bd7f0..08fbc946eef 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -192,7 +192,6 @@ Public API: none. Wire: none. ## Required - [Fallback playback](/quest/m0/test-flakes-2/ietf22-fallback.md) - a browser viewer follows a fallback within the media lane's bound without dropping its session -- [moq-gst's stale-completion sink test survives load](/quest/m0/test-flakes-2/gst-stale-completion.md) - `a_stale_completion_cannot_end_the_next_publication` passes under stress, and its `#[ignore]` is removed - [The embedded relay's sockets are closed when run returns](/quest/m0/test-flakes-2/embed-sockets-outlived.md) - `embed::worker_tokio_custom_route_and_quic` stops failing with "the owner's sockets outlived `run`" - [The http:// fingerprint tests survive a slow fetch](/quest/m0/test-flakes-2/fingerprint-host-clock.md) - a fingerprint fetch slower than the 500 ms hedge no longer trips the host-clock guard - [A lite-07 reply FINs instead of resetting when the subscriber FINs mid-write](/quest/m0/test-flakes-2/lite07-reply-fin.md) - `js/net`'s empty-window reply test passes under `--rerun-each 200`, fixed in the publisher diff --git a/quest/m0/test-flakes-2/gst-stale-completion.md b/quest/m0/test-flakes-2/gst-stale-completion.md deleted file mode 100644 index bce4fc49c35..00000000000 --- a/quest/m0/test-flakes-2/gst-stale-completion.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] moq-gst's stale-completion sink test survives load - -## Goal - -`rs/moq-gst/src/sink/imp.rs`'s `a_stale_completion_cannot_end_the_next_publication` -passes reliably under load, fixed at its cause, and its `#[ignore]` is -removed. - -## Plan - -Planned 2026-11-07 (maintainer, /quest-complete) from -[moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160)'s validation: -it failed once in a 30-iteration stress run of the moq-gst suite at -[8e2db7b9f6](https://github.com/moq-dev/moq/commit/8e2db7b9f609f1c0992049def7499c268ddcf085). -It is quarantined with `#[ignore]` until this quest fixes it, per AGENTS.md. - -The test starts a session against an unreachable URL, stops it, starts a -second one, and asserts that failing the first session's completion leaves -the second's open and the pad relinked to it. Reproduce it under stress -first and record which assertion fails; that decides whether the sink or -the test is wrong. Candidates: a state transition that returns before the -old session's task lets go of the pad; a second session that hasn't linked -its pad by the time `Paused` returns; or the old session's status task -failing its own completion during shutdown before `stale.fail()` runs, which -breaks the test's assumption rather than the sink. Fix a sink defect in the -sink, never by waiting in the test, and prove it with a test that forces -the losing order. - -Public API: none. Wire: none. diff --git a/rs/moq-gst/src/sink/imp.rs b/rs/moq-gst/src/sink/imp.rs index 7521edfc020..5b405e54259 100644 --- a/rs/moq-gst/src/sink/imp.rs +++ b/rs/moq-gst/src/sink/imp.rs @@ -2236,7 +2236,6 @@ mod tests { // A task outliving its session writes into the handle nobody reads any more. Scoping falls out of // the topology: no id comparison guards the state the pads see. #[test] - #[ignore = "flaky under stress; investigation: quest/m0/test-flakes-2/gst-stale-completion.md"] fn a_stale_completion_cannot_end_the_next_publication() { gst::init().unwrap(); let sink = sink(); diff --git a/rs/moq-gst/src/sink/session.rs b/rs/moq-gst/src/sink/session.rs index bd58d2d95c5..bdaf644147e 100644 --- a/rs/moq-gst/src/sink/session.rs +++ b/rs/moq-gst/src/sink/session.rs @@ -388,7 +388,6 @@ impl Session { /// wait, that dial outlives the state change an application waits on before it exits (`gst-launch` /// right after NULL). pub fn stop(self) { - // The status task goes first, so it never reports the loop's end as a failure. self.join.abort(); self.connection.abort(moq_net::Error::Cancel); crate::block_on(async { @@ -474,6 +473,9 @@ async fn forward_registered( } notify(&element, &["status", "connected", "moq-version", "connection-stats"]); } + // `Session::stop` asked for this. Its abort cannot cancel a poll already in flight, so + // the end of the loop can reach the task before the task ends. + Err(moq_tokio::Error::Stopped) => return, Err(err) => { // The reconnect loop stopped on a terminal error (a non-retryable auth failure, or a // bounded backoff's give-up). Ending the publication stops the pad threads feeding a @@ -627,6 +629,26 @@ mod tests { assert!(is_closed(&connection)); } + // The losing order of a stop: the status task polls only after the loop it follows has ended. + #[test] + fn a_local_stop_is_not_a_session_failure() { + let (session, connection) = started(); + let completion = session.completion(); + let status = session.status().clone(); + connection.abort(moq_net::Error::Cancel); + let _ = crate::block_on(connection.closed()); + crate::block_on(forward_registered( + connection, + moq_tokio::origin::spawn(), + status.clone(), + completion.clone(), + glib::WeakRef::new(), + )); + assert!(completion.is_open(), "the stopped publication is not failed"); + assert_ne!(status.status(), ConnectionStatus::Failed); + session.stop(); + } + #[tokio::test] async fn a_terminal_result_waits_until_the_session_is_registered() { let gate = Arc::new(tokio::sync::Notify::new()); From 71c560b76c2b1c83c44206ce053c2021da0a6204 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 20:45:17 -0800 Subject: [PATCH 3/5] fix(moq-gst): tell a stop from a give-up through Connection::closed Co-Authored-By: Claude Opus 5.5 --- rs/moq-gst/src/sink/session.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rs/moq-gst/src/sink/session.rs b/rs/moq-gst/src/sink/session.rs index bdaf644147e..ae76fc791ee 100644 --- a/rs/moq-gst/src/sink/session.rs +++ b/rs/moq-gst/src/sink/session.rs @@ -473,10 +473,13 @@ async fn forward_registered( } notify(&element, &["status", "connected", "moq-version", "connection-stats"]); } - // `Session::stop` asked for this. Its abort cannot cancel a poll already in flight, so - // the end of the loop can reach the task before the task ends. - Err(moq_tokio::Error::Stopped) => return, - Err(err) => { + Err(_) => { + // `closed` tells a stop from a give-up. A stop is what `Session::stop` asked for: its + // abort cannot cancel a poll already in flight, so the loop's end can reach the task + // before the task ends. + let Err(err) = reconnect.closed().await else { + return; + }; // The reconnect loop stopped on a terminal error (a non-retryable auth failure, or a // bounded backoff's give-up). Ending the publication stops the pad threads feeding a // dead session; losing that race means it already ended, so there is nothing to report. From a46b9c73fc7b30e5af0af6c8a5becabeafc0338e Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 21:05:24 -0800 Subject: [PATCH 4/5] fix(quest): drop the stale-completion quarantine entry and mark it fixed Co-Authored-By: Claude Opus 5.5 --- quest/m0/test-flakes-2/README.md | 8 ++++---- sh/gh/test-inventory.allow | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index 08fbc946eef..8d2c1ad1285 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -164,10 +164,10 @@ closed, left no finished record, so the final catalog snapshot started the rendition again and replayed a group on its held pad. A failure now counts as the track's end, fixed by [moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160). -Added 2026-11-07 (maintainer, /quest-complete): moq-gst's stale-completion -sink test, which failed once in 30 stress iterations in -[moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160)'s validation. -It is quarantined with `#[ignore]` until its child fixes it. +moq-gst's stale-completion sink test, which failed once in 30 stress iterations +in [moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160)'s validation, +mistook a give-up for a stop; the session now tells them apart through +`Connection::closed`, fixed by [moq-dev/moq#8246](https://github.com/moq-dev/moq/pull/8246). `js/net`'s lite-07 relative-start integration test, which failed once on main in [moq-dev/moq#8165](https://github.com/moq-dev/moq/pull/8165)'s baseline run, diff --git a/sh/gh/test-inventory.allow b/sh/gh/test-inventory.allow index 76ccc34519f..9e966287ea1 100644 --- a/sh/gh/test-inventory.allow +++ b/sh/gh/test-inventory.allow @@ -36,7 +36,6 @@ ignore moq-video::render::export::dx12::tests::exports_an_nv12_texture /quest/m5 ignore moq-video::render::export::dx12::tests::media_foundation_encodes_the_export_in_place /quest/m5/video-hardware.md # Quarantined flakes, re-enabled by the quest that fixes them. -ignore moq-gst::sink::imp::tests::a_stale_completion_cannot_end_the_next_publication /quest/m0/test-flakes-2/gst-stale-completion.md # Flaky, disabled until its quest fixes the cause. ignore moq-relay::embed::worker_tokio_custom_route_and_quic /quest/m0/test-flakes-2/embed-sockets-outlived.md From b359e1aba6bebdb83f58903c917870a0c873a08d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 21:53:11 -0800 Subject: [PATCH 5/5] quest: name the stale-completion test's cause plainly Co-Authored-By: Claude Opus 5.5 --- quest/m0/test-flakes-2/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index 8d2c1ad1285..3ece0161919 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -166,8 +166,9 @@ the track's end, fixed by [moq-dev/moq#8160](https://github.com/moq-dev/moq/pull moq-gst's stale-completion sink test, which failed once in 30 stress iterations in [moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160)'s validation, -mistook a give-up for a stop; the session now tells them apart through -`Connection::closed`, fixed by [moq-dev/moq#8246](https://github.com/moq-dev/moq/pull/8246). +because the sink reported a stopped session as a terminal failure; the session +now tells a stop from a give-up through `Connection::closed`, fixed by +[moq-dev/moq#8246](https://github.com/moq-dev/moq/pull/8246). `js/net`'s lite-07 relative-start integration test, which failed once on main in [moq-dev/moq#8165](https://github.com/moq-dev/moq/pull/8165)'s baseline run,