Repository navigation
fix(moq-ffi): the in-place shutdown test's timer is never due under load - #9162
Conversation
Quest-Claim: 5089e6cc18205d42
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
|
Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge (test-only fix, standing pick), accepting the decision in the PR body to target the clock's last instant instead of a mocked clock. (Written by Claude Opus 5.5 with high) |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. The held poll still arms tokio's host timer, which is what the test guards. The deadline is now one that no descheduling can reach, so KIO_DENY_HOST_TIMERS=1 can no longer abort the child.
Reviewed changes
Reviewed the full diff: the test change in rs/moq-ffi/src/test.rs and the deleted quest file.
- Held poll deadline:
shutdown_waits_for_an_in_place_pollnow sleeps untilkio::clock::now().saturating_add(Duration::MAX)instead of 1ms. It ends inunreachable!, replacing thepending()tail. I confirmedsleep_untilandInstant::saturating_addexist inrs/kio/src/clock. - Quest file removal: deletes the finished
ffi-shutdown-in-place-poll.mdquest.
claude-sonnet-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughThe shutdown test now holds a Merge Risk:
|

Summary
test::shutdown_waits_for_an_in_place_pollin moq-ffi aborted under load. The held poll armed a 1ms host timer. Whenever the thread was descheduled for more than 1ms between arming that timer and polling it, the timer fired on its first poll, andKIO_DENY_HOST_TIMERS=1aborted the process ("a 994µs timer fired on the host clock").The test only needs the held poll to arm a timer on tokio's host driver after shutdown has begun, since a timer polled after its driver is gone panics. Whether that timer fires was never the point. The held poll now sleeps until the clock's last instant (
kio::clock::now().saturating_add(Duration::MAX)), which no suspension reaches, and the future after it isunreachable!. That still polls, and so arms, tokio's host timer, unlikesleep(Duration::MAX), which parks unarmed. A manual clock (the quest's other option) would bypass tokio's timer driver, which is what the test guards, so it doesn't fit here.Deletes
quest/m0/test-flakes-3/ffi-shutdown-in-place-poll.md.Validation
.tmp/repro.sh). 13 aborted (9 + 4 across two sweeps), every one inkio::clock::runtime::guard::firedfrom the held poll's firstSleep::poll, having waited 991 to 994µs.Runtime::shutdownskip waiting for in-flight polls and delayed the test's release by 200ms. The fixed test then fails 3 of 3 runs with tokio'stime/entry.rs:534panic, so the end-of-time timer still registers on the driver and still catches the bug. Without the delay the mutant usually passes, because the release races the runtime teardown. That gap is older than this PR (the 1ms version has the same race) and this change leaves it unchanged.just checkpasses.Impact
Public API: none. Wire: none. Test-only change.
Caused by
KIO_DENY_HOST_TIMERS=1, which this test's 1ms sleep (from moq-dev/moq#5140) trips whenever it is already due on its first poll (found by check)Decisions
Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: 9c3fac4
Base: origin/main at 5f5daf2
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1f309-3639-7290-8c1a-378f9c0d3eaa, round 2Score: 10/10,
The revised deadline removes the suspension-triggered flake while preserving host timer driver access during shutdown, with no new issues found in the incremental change.Rounds: 2; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0
Findings: none
The last round's findings, at 8686725:
rs/moq-ffi/src/test.rs:8895:Replace the real-time deadline with deterministic synchronization;The head saturates the deadline to the clock's last representable instant, and clock/timer.rs plus clock/runtime.rs confirm that it still polls Tokio's host timer while remaining pending through any practical suspension.