Repository navigation
fix(spec): unlock the archive lock before its file closes - #91
runewright[bot] wants to merge 3 commits into
Conversation
The transaction held the archive lock as a plain File and released it only by closing the file. The lock is a flock on the open file description, so a child process that another thread spawned while the lock was held kept a copy of the descriptor until it exec-ed or exited, and the lock with it. An immediate retry then failed with "another spec archive transaction holds" the lock: spec::tests::archive_retry_reports_the_existing_dated_archive failed that way on the cli 84 Test job, because rune-docs unit tests run as threads of one process and the doctor tests spawn children. HeldLock unlocks in Drop before the close, for the transaction and for the doctor probe. A new test holds a duplicate descriptor, drops the transaction, and takes the lock again; it fails with the CI error without the unlock. In a stress loop with four spawning threads, 26 of 2000 retries failed before the change and 0 of 2000 after. Co-Authored-By: Martin Zeman <N4M3Z@users.noreply.github.com>
|
review/correctness round 1 started on |
|
Claude finished @Runewright[bot]'s task in 3m 4s —— View job Correctness review
Looks good. Verified:
Minor, non-blocking:
I could not run |
Runeseer review — cleanLooks good. The new head commit carries the same file tree as the previously reviewed commit, so no code changed and nothing new needs review.
No open findings · Reviewed |
…ee":"562b4177558209dc6be51729b53e926ed2a11c39","nonce":"1c077194f7bbf491d568b42fd139b78bab3679942cafc575a8f37cdafdb732d8"}
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
review/correctness round 2 started on |
…","generation":1,"digest":"5c9ee55a787590551f2a82b9417e1bc0ff7d95a422cc3e7d88c8cb601ee07a51"}
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The change explicitly releases the archive lock when its existing scope ends, preventing inherited descriptor copies from delaying retries. Transaction locking scope and archive data operations remain unchanged, with a focused regression test added. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
review/correctness round 3 started on |
|
Claude finished @N4M3Z's task in 43s —— View job Runeseer review — clean
Looks good. This head carries the same file tree as the previously reviewed commit
No open findings · Reviewed |
Releases the spec archive lock when a transaction ends, so an immediate retry no longer fails while another thread's child process still holds a copy of the lock descriptor.
Plan
The lock belongs to the open file description, and a child process spawned by any thread inherits the descriptor until its exec. Closing the file alone leaves the lock held, so the guard unlocks first.
Changes
HeldLockinrune-docs/src/spec/transaction/mod.rs, which unlocks the lock file inDropbefore the descriptor closes.HeldLockinTransaction, and wraps the lock inacquire_with_ioandhealth_findings.a_dropped_transaction_releases_the_lock_that_a_duplicate_descriptor_sharesinrune-docs/src/spec/transaction/tests.rs, ignored on Windows.CHANGELOG.mdline under Fixed.Testing
mainand 0 of 2000 with the fix, on macOS. The same loop without the spawning threads failed 0 of 2000.cargo test, passed on this head.Release Notes
Open-Seal-Nonce: 1c077194f7bbf491d568b42fd139b78bab3679942cafc575a8f37cdafdb732d8
Note
Unlock spec archive lock before its file closes
HeldLockguard in mod.rs that wraps the lock file and explicitly unlocks it onDrop, before the descriptor closes. This fixes retries that fail when a child process holds a copied descriptor, since a close alone does not release the lock in that case.Transactionnow stores aHeldLockinstead of aFile, andacquire_with_io,health_findings, andincomplete_transaction_findingsall use the guard, including on early returns.Macroscope summarized aa2218e.