Repository navigation
test(daemon-health): repair the two racy waiter tests that reddened main in 44790566297 - #2117
Merged
Merged
Conversation
wait_outlasts_the_base_budget_while_the_daemon_reports_starting asserted served == 21 and phases.len() == 20. A pooled connection closed under the HTTP client can make it replay a request, so the fixture serves one answer twice and the number of *observed* answers is not derivable from outside; the two equalities flaked at 19 observed of 21 served on the loaded runner in run 44790566297 (2026-11-20, tree dad7c6b). Assert bounds plus the phase content, and keep the load-bearing #1480 property explicit: the wait outlives the 300 ms base budget. wait_gives_up_on_an_unreachable_endpoint_after_the_base_budget bound port 0, dropped the listener and hoped nothing would answer on that port again. This module's own serve() could be handed the same ephemeral port by the kernel and answer 503 starting, which panicked the same run. Own the port for the whole test instead: accept and close every connection.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Why
mainatdad7c6b3went red in run 44790566297 (glibc 2.17 floor / Check (ubuntu-latest)→Test), on two tests incrates/fbuild-core/src/daemon_health.rsthat measure the waiter with exact round-trip counts and rely on an ephemeral port staying free:wait_outlasts_the_base_budget_while_the_daemon_reports_starting—assert_eq!(phases.len(), 20)failed with 19 whileserved == 21passed.wait_gives_up_on_an_unreachable_endpoint_after_the_base_budget—an unreachable endpoint never reports starting: the port the test bound and dropped was handed by the kernel to a sibling test'sserve(), which answered503 startingon it.Neither is a product defect: the merge-group run of the same tree (44788087887, 17:56Z, 16 min earlier) was green, and the sibling
linux / Check (ubuntu-latest)job at the same commit was green. Load-dependent test races, not a regression from #2116.What changed (test code only —
daemon_health.rs, +46/−10)served >= 21,phases.len() >= 10, every observed phase iscompile_backend, and — the property Upgrade zccache to latest (with zccache#1710), flush the embedded backend on daemon exit, and wait on a daemon that is still starting #1480 is actually about — the wait outlived the 300 ms base budget (waited >= 300 ms, previously implicit in the count).serve_nothing()binds a listener for the whole test and closes every accepted connection, so a probe sees "no answer" and no sibling test can claim the port. The 300 ms floor is now asserted explicitly.Proof
cargo test -p fbuild-core --lib daemon_healthwait_*tests, 25 consecutive runs under loadavg 29–47 / 16 corescargo test -p fbuild-core --libcargo clippy -p fbuild-core --all-targets --no-deps -- -D warningscargo fmt -p fbuild-coreci/enforce_platform_boundary.py --print-totalsrows=6; dylint_rows=6exit 0 (untouched)Red proofs (each reverted before the commit):
ReadinessDeadline::observe(the Upgrade zccache to latest (with zccache#1710), flush the embedded backend on daemon exit, and wait on a daemon that is still starting #1480 regression) →wait_outlasts_…FAILS (TimedOutvsHealthy). The loosened assertions still catch the behaviour they exist for.Starting→wait_gives_up_…FAILS withan unreachable endpoint never reports starting.Test-only change; no production behaviour, ledger, or research TSV touched.
#1315untouched.