test: harden stress_no_fd_leak against shared-runner fd churn#575
Open
enricopiovesan wants to merge 2 commits into
Open
test: harden stress_no_fd_leak against shared-runner fd churn#575enricopiovesan wants to merge 2 commits into
enricopiovesan wants to merge 2 commits into
Conversation
The absolute after<=before assertion failed on unrelated descriptor activity on shared CI runners (docs-only PR #572). Take the baseline after warm-up cycles, measure as the minimum of several samples, assert on growth with a small fixed tolerance, and retry the measurement before failing. A real per-cycle leak over 1,000 cycles still exceeds the tolerance by two orders of magnitude. Closes #574 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Harden the flaky
stress_no_fd_leakstress test so it no longer fails on unrelated descriptor churn on shared CI runners (it failed on docs-only PR #572 on x86_64-unknown-linux-gnu, then passed on re-run), while keeping it a meaningful leak detector.Governing Spec
047-thread-pool-executorAcceptance scenario 5.2 of spec 047 ("Given repeated executor create-use-drop cycles, When resource checks run, Then no file descriptor or handle leak is detected") still holds: the hardened detector fires on any genuine per-cycle leak (verified by injecting one leaked descriptor per cycle, which fails the test).
Project Item
What Changed
crates/traverse-runtime/tests/thread_pool_stress.rs.Test hardening details:
after <= beforecheck. A real per-cycle leak produces growth of ~1,000 descriptors, so the tolerance cannot mask one.Definition of Done
stress_no_fd_leakuses warm-up baseline + growth-with-tolerance assertion + retried measurementstd::mem::forget(File::open(...))per cycle — test failed as expected)Validation
BASE_SHA=origin/main bash scripts/ci/spec_alignment_check.shon this body)cargo test -p traverse-runtime --test thread_pool_stress -- --ignored --nocapture: 9 passed, 0 failed)cargo fmt --checkandcargo clippy -p traverse-runtime --testscleanNotes
Fixes the flake reported in #574. The tolerance (8 fds) is deliberately small relative to the 1,000-cycle window so the test cannot be silenced by threshold inflation — any per-cycle leak exceeds it by two orders of magnitude.