fix(daemon): lifecycle idle-timer tests on tokio's paused clock - #611
Merged
Conversation
The six run_idle_timer tests slept on the real clock with 100-300 ms deadlines; on a stalled Windows CI runner a >20 ms hiccup let a deadline fire before the activity reset landed, and the ci profile treats flaky as failure (session_tier_upgrade_extends_timeout, main run 32601124030). start_paused = true makes every sleep advance virtual time deterministically, and assertion instants now sit off the timer's own deadline grid so exact-instant poll-order ties cannot happen either.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Windows CI flake in main run 32601124030:
session_tier_upgrade_extends_timeoutfailed on TRY 1 and passed on TRY 2, and the ci nextest profile treats flaky as failure.Root cause: the six
run_idle_timertests slept on the real clock with 100–300 ms deadlines. On a loaded Windows runner, a >20 ms scheduling stall between a sleep completing and the activity reset landing lets the idle deadline fire first — the test then observes a retired timer it expected alive. All six tests in the cluster share the hazard; only the tightest one (80 ms of a 100 ms window) has tripped so far.Fix:
#[tokio::test(start_paused = true)]—run_idle_timeris pure tokio time (tokio::time::sleep/Instant), so the virtual clock drives it deterministically and runner load can never reorder deadline vs. reset. Because virtual time makes every firing exact, assertion instants were also moved off the timer's own deadline grid (e.g.active_connections_defer_retirementasserted at t=200/400 ms, exactly on the defer re-arm deadlines — now 250/500 ms) so exact-instant poll-order ties cannot appear as a new flake class.Test-only change, no production code touched, no version bump. Cluster runs 3× green locally in 0.12 s (was >1 s of real sleeping).