Repository navigation
test(desktop): make the instance-guard flake diagnosable - #852
Merged
Merged
Conversation
`excludes_second_owner_and_releases_on_drop` failed 3 times in ~20 full-suite
runs and never once in isolation (150 single runs, 320 concurrent runs of the
same test binary, several full-suite runs). Each time with only:
assertion failed: InstanceGuard::at(directory.path()).is_ok()
That says nothing about *why*. The failure is on the re-acquire **after**
`drop(guard)` — not on the contended-acquire assertion, which is what I had
assumed before capturing the real message — so the two candidates are "the lock
was not released" and "the `open` failed for an unrelated reason". Those point
at completely different owners, and one of them is a real product bug.
The assertion now reports the error, so the next occurrence is diagnosable
instead of costing another investigation. No behaviour change: the test asserts
exactly what it did before.
One hypothesis already ruled out: **file-descriptor exhaustion**. The suite runs
1312 tests green under `ulimit -n 256`, so the library's own fd use is not
near the limit.
Not fixed — diagnosed. This is deliberately not part of the payload-trim PR
(#849): unrelated subject, and it should be reconsidered if the cause turns out
to be a product bug.
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.
The problem with reporting this as a bug
instance::tests::excludes_second_owner_and_releases_on_dropfailed 3 times in ~20 full-suite runs and never once in isolation (150 single runs, 320 concurrent runs of the same test binary, several further full-suite runs).Each failure printed only:
Which says nothing about why. I captured the real message this time, and it corrected my own earlier assumption: the failure is on the re-acquire after
drop(guard), not on the contended-acquire assertion I had suspected.That leaves two candidates pointing at completely different owners:
openfailed for an unrelated reason (an environmental race) → a test issueA bare
is_ok()cannot distinguish them.What this change does
Reports the error. Nothing else — the test asserts exactly what it did before.
What this change does not do
It does not fix the flake. I could not reproduce it on demand, so I have no evidence for a root cause and will not invent one. The value is that the next occurrence is diagnosable instead of costing another investigation.
Already ruled out
File-descriptor exhaustion. My working assumption, since this host has a soft limit of 2560 and the suite opens sockets, locks and temp files. The full suite runs 1312 tests green under
ulimit -n 256, so the library's own fd use is not near the limit. Hypothesis dead.Verification
cargo test --lib instance::→ 3 passed;cargo fmt --checkandcargo clippy --all-targets --manifest-path desktop/src-tauri/Cargo.toml -D warningsclean on pinned 1.97.Why it is not bundled with the payload-trim PR
It was written while working in that branch, but it is unrelated in subject and would blur that PR's rollback boundary. If the cause turns out to be a product bug, it deserves its own fix and its own discussion.