Add nextest slow-timeout to fail hung tests loudly - #193
Open
Saurabh Singh (saurabh500) wants to merge 2 commits into
Open
Add nextest slow-timeout to fail hung tests loudly#193Saurabh Singh (saurabh500) wants to merge 2 commits into
Saurabh Singh (saurabh500) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e2c378f8-3ba1-4b48-9ebe-5a4ea2bd2761
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e2c378f8-3ba1-4b48-9ebe-5a4ea2bd2761
Saurabh Singh (saurabh500)
marked this pull request as ready for review
August 8, 2026 20:00
Saurabh Singh (saurabh500)
marked this pull request as draft
August 8, 2026 20:01
Contributor
There was a problem hiding this comment.
Pull request overview
Adds bounded timeouts to prevent hung tests from blocking CI and local nextest runs indefinitely.
Changes:
- Terminates tests after three 60-second slow periods.
- Applies the timeout to both CI and default profiles.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Saurabh Singh (saurabh500)
marked this pull request as ready for review
August 8, 2026 20:02
Saurabh Singh (saurabh500)
enabled auto-merge (squash)
August 8, 2026 20:03
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 🔗 Quick Links |
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.
Summary
Adds a nextest
slow-timeoutso a hung or spinning test is terminated and fails loudly instead of hangingcargo btestforever. We just hit a 30+ minute forever-hang because the runner has retries but no timeout.Config change (exact TOML diff)
A test running longer than
period(60s) is flagged SLOW; afterterminate-after(3) such periods (~180s) nextest terminates it and marks it failed. Added to both[profile.ci](used bycargo btest --profile ci) and[profile.default](plaincargo nextest run) so local runs are protected too. Retries and all other keys are unchanged.Condition (a): no healthy test legitimately runs past 60s ✅
Pulled the slowest passing tests from the CI JUnit timings (
target/nextest/ci/junit.xml, 2237 passing tests):mssql-tds connection::transport::localdb::tests::test_resolve_mssqllocaldbtest_no_protocol_resolution::...test_msf_with_instance_and_explicit_port_allowedtest_multi_subnet_failover::...test_msf_connection_refusedtest_multi_subnet_failover::...test_msf_invalid_hostconnection_provider::...retry_with_unreachable_hostSlowest healthy test is 20.3s — comfortably under 40s, giving a ~3x margin to the 60s threshold. 60s is safe; keeping it (no bump to 90s needed).
Condition (b): real worst-case bound
[profile.ci]hasretries = 5→ 6 attempts. Retries apply to any non-success outcome, and a deterministic hang is terminated after3 × 60s = 180s(~3 min) per attempt.Worst case = 6 attempts × 3 min = ~18 min for a deterministic hang. This is bounded and a large improvement over the previous 30+ min forever-hang, but it is honestly higher than the earlier "≤3 min" estimate (that was per-attempt, before accounting for retries).
Investigation: can we avoid retrying terminations?
Checked nextest 0.9.88 (the pinned toolchain version):
count/backoff/delayand per-test-name overrides — none filter by outcome type. A hang is retried the full 5×.on-timeout = "pass"(treat timeouts as success) exists only from 0.9.115, and it changes pass/fail semantics, not retry behavior.grace-periodis ignored for timeouts (immediate job-object kill), so each terminated attempt is ~180s exactly.Conclusion: no no-retry-on-termination option is available in this version, so retries are left as-is and the ~18 min worst-case applies. A reviewer may optionally choose to lower
retriesfor the terminated case, but that would also reduce flake-retry coverage for genuine failures, so it's left untouched here.Validation
cargo bfmt— cleancargo bclippy— clean (warnings-as-errors)cargo nextest list --profile ciand--profile default— both exit 0 (config parses, runner accepts it). Pre-existing integration-test failures require a live SQL Server and are unrelated to this TOML-only change.Note
TOML-only change to shared CI config. Values approved upstream:
period = "60s",terminate-after = 3, mirrored into[profile.default].