GPU: serialize pipeline library atomic writes with unique temp files #1660
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!1660
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1660/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?
@HailLucifer666 on GitHub · 2026-11-24 20:33 UTC · original
HailLucifer666:fix/pipeline-library-atomic-write-race→main· +38 −4 · 1 files · 1 commits · merged 2026-11-25 00:15 UTCIssue:
pipeline::library::savereleases bothLASTandlibrarylocks before callingwrite_atomically, which always wrote to the same fixedhost-pipelines.tmppath. Concurrent pipeline worker saves and shutdownsave(true)can truncate or unlink each other's temp file on Windows, failing or corrupting the saved pipeline library.Fix:
write_atomicallywith a mutex, write to a unique per-call temp file (.tmp-<pid>-<n>), and clean up the temp file ifrenamefails.concurrent_write_atomically_never_fails_or_truncates.Verification:
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(clean)cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings(clean)cargo test -p victory-gpu --locked(51 passed, 0 failed, 1 ignored)cargo test -p xtask --locked(4 passed, 0 failed)@acetonahard-code on GitHub · 2026-11-24 22:11 UTC · original
Overlap: #72 already serializes pipeline-library saves and writes each publication to a unique temporary file. That's a superset of this change. The two conflict in
library.rs.Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current
main(70564ae):cargo test -p victory-gpumainmain+ this PRmain,--all-featuresmain+ this PR,--all-featurescargo clippy --all-targets -- -D warnings, with and without--all-features: clean.victory-gputests fail on currentmainon this NVIDIA card:dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.