Repository navigation
fix: wait out a transient writer-lock duplicate and make the lock and doctor tests hermetic - #718
Merged
Merged
Conversation
…oaded machine A reopen waits out a transient duplicate of a closed writer lock for up to 20 s when no handle of this process holds it, and still refuses a real second open at once. The session_effort e2e serialises fork+exec against fixture creation. The doctor unreachable-provider test keeps its port bound.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
2 of 3 tasks
ajianaz
added a commit
that referenced
this pull request
Nov 14, 2026
…again (#725) ## What Gate the #718 lock-identity probe (`std::os::unix::fs::MetadataExt`, dev/ino) behind `#[cfg(unix)]`; on non-unix it returns `None`. ## Why `tole-core` stopped compiling on `x86_64-pc-windows-msvc` (E0433 `os::unix`, E0599 `dev`/`ino` at `storage.rs:1169`), which failed the v0.11.0 release train's Windows build job (run 43574225374) while Linux×2 and macOS stayed green. Windows has no fork, so the transient duplicate-of-closed-descriptor retry (#552, #712) cannot occur there — `None` restores the pre-#718 behavior where a self-pid hold is a real hold. Unix behavior unchanged. ## Testing - [x] `cargo check -p tole-core` clean - [x] `cargo test -p tole-core --lib storage` 4/4 passed - [ ] CI Windows job builds on this PR Co-authored-by: ajianaz <[email protected]>
This was referenced Nov 14, 2026
ajianaz
added a commit
that referenced
this pull request
Nov 14, 2026
## What Release sync for v0.11.0 as ONE squash commit on a main-based branch: main + the develop delta (release prep #723/#724 and the storage fix #725). The commit's tree is identical to develop's tree (verified: git diff of the two trees is empty), so the tagged tree equals the fully validated tree. ## Why The first v0.11.0 run (tag on e833469) failed x86_64-pc-windows-msvc: #718's std::os::unix::fs::MetadataExt use had no cfg gate, so tole-core did not compile on Windows (run 43574225374). #725 gates the probe (Windows returns None; no fork there, so the transient-duplicate retry never applies) and is on develop with 15/15 checks green. A merge-commit sync (#727, closed) trips the message-standard check on 17 pre-ban Co-authored-by trailers still in develop's v0.9/v0.10 history; a direct develop->main PR (#726, closed) conflicts after the #724 squash merge. The one-commit squash on a main-based branch carries the same content with none of those problems. ## Testing - [x] PR #725 (the fix): 15/15 checks green on develop - [x] Local cargo check + storage tests 4/4; cross-check vs x86_64-pc-windows-msvc shows no tole-core errors - [x] This branch's tree == develop tree (content parity proven) - [ ] This PR's CI green, then re-tag v0.11.0 to the new main HEAD Co-authored-by: ajianaz <[email protected]>
This was referenced Nov 14, 2026
ajianaz
added a commit
that referenced
this pull request
Nov 14, 2026
CI ran only on pull requests, and pull requests are squash-merged on stale bases, so nothing ever built the merged develop; that is how a missing cfg gate (#718) reached the v0.11.0 Release workflow. The push trigger of ci.yml now covers develop as well as main, so every merge to develop builds and tests the merged tree, including the Windows and macOS OS Check jobs and the Sandbox job. These runs are informational and not required checks.
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
Fixes the spurious
session is open for writing by pid Nfailure ofsession_effort_e2e::a_rejecting_provider_still_answers_without_the_parameter(#646), a related lock race inlock_writer, and a port-reuse race indoctor::tests::catalog_flags_an_unreachable_provider(#712).Why
tole resume. A child forked by another test thread holds a duplicate of the just-closed lock descriptor until it execs (anflockbelongs to the open file description), so the resumedtolesees the lock held by the test pid. Reproduced: 4 of 400 rounds failed with 6 threads spawning children on one CPU, with exactly that message.lock_writer(fix(storage): a fork+exec in another thread makes a reopen after drop fail with Locked #552) only retried such a transient for 150 ms. On a starved machine a forked child can stay unscheduled much longer, which is the likely cause of thetui_hosttree-after-fork failure of flaky tests under a 1-CPU stress run: doctor::catalog_flags_an_unreachable_provider and tui_host tree_after_fork #712 (not reproduced directly, see Testing).catalog_flags_an_unreachable_providerfreed an ephemeral port and then used it as the dead provider. Another parallel test's mock can take the port in between, the provider then answers/modelsand theblocker.unwrap()hitsNone.Changes
tole-core/src/storage.rs: the writer lock is now aWriterLockthat registers its file identity in a process-wide set while held. A hold that names our own pid is retried (up to 20 s, in 5 ms steps) only when no handle of this process holds it; a real second open in this process (storage: no cross-process writer exclusion — a second writer corrupts the session file (live repro) #475) and any other holder still fail at once.tests/writer_lock.rs:a_reopen_waits_out_a_long_lived_duplicate_of_a_closed_lock(a duplicate held for 700 ms; fails on the old 150 ms retry). The retried-pid test uses the same simulated duplicate.tests/session_effort_e2e.rs:fork+execof a child is serialised against fixture creation (SPAWN), plusa_resume_is_never_refused_by_children_forked_by_other_threads, which failed before the fix.doctor.rstest: the dead port stays bound to a listener that hangs up on every connection.Testing
a_reopen_waits_out_a_long_lived_duplicate_of_a_closed_lockfails on the old code;a_resume_is_never_refused_by_children_forked_by_other_threadsfailed 4 of 400 rounds without the mutex (taskset -c 0) and passes with it.taskset -c 0, 4 busy loops, 64 test threads, 70 runs each:doctor::catalog_flags_an_unreachable_provider,tui_host::tree_after_fork...,delegate::an_independent_participant...,wire_size_missionsall passed. These four were not reproduced (fewer than 200 runs), so the doctor and tui_host fixes follow from the analysis above and are not backed by a failing run; delegate and wire_size_missions are left unchanged.cargo fmt,clippy --workspace --all-targets --all-features -D warnings,cargo test --workspacetwice,tole-core --no-default-features, andsession_effort_e2ewith--no-default-features --features shell-tools: green.Closes #646
Refs #712
Refs #702