From 825fe732c56b75c064e7c0c218116b443defc0e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 10:06:47 +0000 Subject: [PATCH] model-provider: every held-lock journal test takes its lock with the bounded retry 50515055 fixed one test. Four other test sites still took the journal directory lock with one try_lock(). A child forked on another test thread can briefly hold a copy of an earlier lock fd (#381), so they failed with "WouldBlock" in CI (live_transaction_creator_preserves_partial_files_and_bindings, journal.rs:4336, run 39018319086). They now use lock_journal_directory, the provider's own bounded retry. Test code only. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K --- capsules/model-provider/src/journal.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/capsules/model-provider/src/journal.rs b/capsules/model-provider/src/journal.rs index d3c6878f2..9cb7b04ca 100644 --- a/capsules/model-provider/src/journal.rs +++ b/capsules/model-provider/src/journal.rs @@ -3941,13 +3941,17 @@ mod tests { } let root_writer = if hold_root { let held = open_journal_directory(&root).unwrap(); - held.try_lock().unwrap(); + // Take the lock with the provider's bounded retry: a child forked on + // another test thread can briefly hold a copy of an earlier lock fd (#381). + lock_journal_directory(&held).unwrap(); Some(held) } else { None }; let runs_writer = open_journal_directory(&root.join("runs")).unwrap(); - runs_writer.try_lock().unwrap(); + // Take the lock with the provider's bounded retry: a child forked on + // another test thread can briefly hold a copy of an earlier lock fd (#381). + lock_journal_directory(&runs_writer).unwrap(); assert_eq!( RunJournal::open(root.clone()).err().unwrap().code(), "selection_unavailable" @@ -4260,7 +4264,9 @@ mod tests { let root = temp_root("briefly-held-writer"); let journal = RunJournal::open(root.clone()).unwrap(); let holder = open_journal_directory(&root.join("runs")).unwrap(); - holder.try_lock().unwrap(); + // Take the lock with the provider's bounded retry: a child forked on + // another test thread can briefly hold a copy of an earlier lock fd (#381). + lock_journal_directory(&holder).unwrap(); let release = std::thread::spawn(move || { std::thread::sleep(std::time::Duration::from_millis(100)); drop(holder); @@ -4333,7 +4339,9 @@ mod tests { #[cfg(unix)] let _writer = { let writer = open_journal_directory(temp.parent().unwrap()).unwrap(); - writer.try_lock().unwrap(); + // Take the lock with the provider's bounded retry: a child forked on + // another test thread can briefly hold a copy of an earlier lock fd (#381). + lock_journal_directory(&writer).unwrap(); writer }; assert!(RunJournal::open(root).is_err());