Pipeline: accept existing entry when concurrent cache publication races on Windows #1324
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1324
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1324/head"
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?
@mgunes1311-lab on GitHub · 2026-11-24 17:26 UTC · original
mgunes1311-lab:pipeline-cache-concurrent-publish→main· +65 −3 · 1 files · 4 commits · merged 2026-11-25 21:50 UTCOn 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)@acetonahard-code on GitHub · 2026-11-24 21:04 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 02:35 UTC · original · edited 2026-11-25 07:21 UTC
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
@mgunes1311-lab on GitHub · 2026-11-25 04:52 UTC · original
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.