Skip to content

test(daemon-health): repair the two racy waiter tests that reddened main in 44790566297 - #2117

Merged
zackees merged 1 commit into
mainfrom
agent/daemon-health-test-race
Nov 20, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/daemon-health-test-race

Conversation

@zackees

@zackees zackees commented Nov 20, 2026

Copy link
Copy Markdown
Member

Why

main at dad7c6b3 went red in run 44790566297 (glibc 2.17 floor / Check (ubuntu-latest) → Test), on two tests in crates/fbuild-core/src/daemon_health.rs that 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 while served == 21 passed.
  • 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's serve(), which answered 503 starting on 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)

  1. Counts → properties. The waiter can see fewer answers than the fixture serves, because a pooled connection closed under the HTTP client makes it replay a request and the fixture then serves that answer twice; the number of observed answers is therefore not derivable from outside the waiter. Assert served >= 21, phases.len() >= 10, every observed phase is compile_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).
  2. Own the port. New 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

gate result
cargo test -p fbuild-core --lib daemon_health 11 passed / 0 failed
same 3 wait_* tests, 25 consecutive runs under loadavg 29–47 / 16 cores 25/25 green, 0 failures
cargo test -p fbuild-core --lib 454 passed / 0 failed / 2 ignored (15.6 s)
cargo clippy -p fbuild-core --all-targets --no-deps -- -D warnings exit 0
cargo fmt -p fbuild-core clean
ci/enforce_platform_boundary.py --print-totals rows=6; dylint_rows=6 exit 0 (untouched)

Red proofs (each reverted before the commit):

Test-only change; no production behaviour, ledger, or research TSV touched. #1315 untouched.

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.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 26c6506 Nov 20, 2026
32 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 21, 2026
@zackees
zackees deleted the agent/daemon-health-test-race branch November 24, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant