From b702340ca0421e61f76d76f25c9b3c9a44289a90 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 00:43:28 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md Quest-Claim: 5089e6cc18205d42 From 8686725e3b59d72559b52078a8507904d1e165b6 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 00:59:55 -0800 Subject: [PATCH 2/3] fix(moq-ffi): the in-place shutdown test's timer is never due under load The held poll armed a 1ms host timer. Descheduled for over 1ms between arming and polling it, the timer fired on its first poll, which KIO_DENY_HOST_TIMERS aborts. The test only needs the timer armed on tokio's driver after shutdown begins, so it now never comes due. Co-Authored-By: Claude Opus 5.5 --- .../m0/test-flakes-3/ffi-shutdown-in-place-poll.md | 13 ------------- rs/moq-ffi/src/test.rs | 9 +++++---- 2 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md diff --git a/quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md b/quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md deleted file mode 100644 index d3b1d470c9..0000000000 --- a/quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md +++ /dev/null @@ -1,13 +0,0 @@ -# [S] moq-ffi's in-place shutdown test holds under load - -## Goal - -`test::shutdown_waits_for_an_in_place_poll` in `rs/moq-ffi/src/test.rs` passes however loaded the machine is. - -## Plan - -It failed once under a full `just check` on 2026-11-18 at load average 31, on a branch that touched no moq-ffi code ([moq-dev/moq#9123](https://github.com/moq-dev/moq/pull/9123)), and passed six runs alone. -The child process aborted with "a 994.299µs timer fired on the host clock, which KIO_DENY_HOST_TIMERS=1 denies": the held poll's `kio::clock::sleep(Duration::from_millis(1))` fired on the host clock before shutdown cancelled it. -Reproduce it under load first, then drive that sleep from a mocked clock, or wait on an event instead, so the test still shows that only the shutdown finishes the held call. - -Decided 2026-11-19 (coordinator, maintainer away, merge granted): keep this follow-up. diff --git a/rs/moq-ffi/src/test.rs b/rs/moq-ffi/src/test.rs index 5f104a28ee..f8215fe2ee 100644 --- a/rs/moq-ffi/src/test.rs +++ b/rs/moq-ffi/src/test.rs @@ -8886,15 +8886,16 @@ fn shutdown_waits_for_an_in_place_poll() { let (entered, entered_rx) = std::sync::mpsc::channel(); let (release, release_rx) = std::sync::mpsc::channel::<()>(); - let poller = std::thread::spawn(move || { + let poller = std::thread::spawn(move || -> Result<(), MoqError> { let task = crate::ffi::Task::new(()); let run = task.run(|_| async move { entered.send(()).unwrap(); // Holds this poll open while shutdown starts on another thread. release_rx.recv().unwrap(); - kio::clock::sleep(Duration::from_millis(1)).await; - // Even if the sleep is already due, only the shutdown may finish this call. - std::future::pending::>().await + // Arms a timer on tokio's host driver, which shutdown must not stop under this poll. + // Never due within the test, so only the shutdown finishes this call. + kio::clock::sleep(Duration::from_secs(3600)).await; + unreachable!("the timer outlives the test") }); tokio::runtime::Builder::new_current_thread() .build() From 9c3fac43c845ee9dd45f3496ccf01dd36857f413 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 01:06:39 -0800 Subject: [PATCH 3/3] fix(moq-ffi): the held poll's timer waits for the clock's last instant A longer real wait is still a real wait. The end of time is never reached, yet still arms the timer on tokio's host driver. Co-Authored-By: Claude Opus 5.5 --- rs/moq-ffi/src/test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rs/moq-ffi/src/test.rs b/rs/moq-ffi/src/test.rs index f8215fe2ee..5aedf29f41 100644 --- a/rs/moq-ffi/src/test.rs +++ b/rs/moq-ffi/src/test.rs @@ -8893,9 +8893,9 @@ fn shutdown_waits_for_an_in_place_poll() { // Holds this poll open while shutdown starts on another thread. release_rx.recv().unwrap(); // Arms a timer on tokio's host driver, which shutdown must not stop under this poll. - // Never due within the test, so only the shutdown finishes this call. - kio::clock::sleep(Duration::from_secs(3600)).await; - unreachable!("the timer outlives the test") + // The clock never reaches its last instant, so only the shutdown finishes this call. + kio::clock::sleep_until(kio::clock::now().saturating_add(Duration::MAX)).await; + unreachable!("the clock reached its last instant") }); tokio::runtime::Builder::new_current_thread() .build()