Pipeline: accept existing entry when concurrent cache publication races on Windows #1324
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1324"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-24T17:26:18Z.
On Windows,
std::fs::rename(&tmp, &path)fails with access denied / sharing violation if another thread or process concurrently finishes publishing the same content-addressedCacheKeyentry and holds an open read handle onpathafter thepath.is_file()check at line 51.Changes
std::fs::renameseparately inCache::get_or_convert(crates/victory-pipeline/src/cache.rs).std::fs::rename(&tmp, &path)fails, remove the staging file and returnOk(path)whenpath.is_file()is now true (still propagating the error whenpathis not a file, e.g. a directory).accepts_entry_published_concurrently_while_open.Verification
cargo test -p victory-pipeline --target x86_64-pc-windows-msvc --locked(5 passed; 0 failed)cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --lockedcargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged(asset policy: 1 files ok)Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T21:04:56Z.
Tested on Windows 11 with the repo toolchain, merged into current
main(ffe310e):cargo test -p victory-pipelinemainmain+ this PRcargo clippy --all-targets -- -D warnings, with and without--all-features: clean.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:35:31Z.
Automated triage for the maintainers.
Merge candidate. Update after your rebase:
Cache::get_or_convert(crates/victory-pipeline/src/cache.rs) now returns the existing entry when the rename fails and another writer has already published that key. That is correct because entries are content-addressed and every writer publishes by write-then-rename, so an existing file is always complete. A failed write still removes the staging file and returns the error. When the target is not a file (as infailed_publication_removes_the_staging_file), the rename error is still returned. The Windows testaccepts_entry_published_concurrently_while_opennow uses the(PathBuf, File)return oftempfile_incorrectly: it holds the entry open withFILE_SHARE_READ, confirms that a rename over it fails, and checks that only the published entry is left in the directory. It merges cleanly withmain(940d32f).CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-25T04:52:55Z.
Rebased onto current
main(940d32f), adaptedaccepts_entry_published_concurrently_while_opentotempfile_in's(PathBuf, File)return signature while keeping thepath.is_file()fallback afterrename, and verifiedcargo test -p victory-pipeline --locked(8/8 passed) +clippylocally.