Repository navigation
test(desktop): make the instance-lock flake a bounded retry instead of a panic - #857
Merged
Merged
Conversation
…eaked `excludes_second_owner_and_releases_on_drop` failed intermittently under full-suite load (3 times in ~20 runs) at the re-acquire after `drop`, and never in isolation (150 single runs, 320 concurrent runs, several full suites). fd exhaustion was measured and ruled out: all three instance cases pass under `ulimit -n 128`, where 284 other tests fail with EMFILE, so the suite's peak demand stays well below the 2560 soft limit. A sibling test's `Command::spawn` forks while the guard is open and the child shares the open file description until it execs; `flock` ownership follows the description rather than the fd, so the lock can still read as held for that window. Retry briefly instead: a lock that is really never released still fails here, after the deadline.
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.
What
instance::tests::excludes_second_owner_and_releases_on_dropfailed intermittently at the re-acquire afterdrop. It now retries briefly (2s, 10ms steps) before reporting a leaked lock, so a transient fork window does not read as a product bug.Why the retry is the right shape
A sibling test's
Command::spawnforks while this guard is open. The child shares the open file description until it execs, andflockownership follows the description rather than the fd, so the lock can still read as held for that window. Retrying keeps the assertion's meaning: a lock that is really never released still fails here — just after the deadline.Evidence gathered
ulimit -n 128, where 284 other tests fail withEMFILE; the suite's peak demand is therefore well under the 2560 soft limit, and this test holds no fds of its own.Command::spawns) triggers it, ~3 times in ~20 runs — consistent with the fork window above.fs2'stry_lock_exclusivecallsflockonce with noEINTRretry (read fromfs2-0.4.3/src/unix.rs), so an interrupted syscall surfaces as a non-WouldBlockerror rather than a lock verdict.Mechanism is inferred, not reproduced — the retry is bounded so this does not mask a real leak, and the diagnostic message added earlier is kept for the deadline case.
Checks
cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --check— cleancargo clippy --manifest-path desktop/src-tauri/Cargo.toml --all-targets -- -D warnings— cleancargo test --manifest-path desktop/src-tauri/Cargo.toml --lib instance::— 3 passed