fileback, shadow: clean up orphaned cpu-mirrors .tmp files on startup #4715
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4715
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4714"
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?
@nidea1 on GitHub · 2026-12-01 03:10 UTC · original
nidea1:fix/cpu-mirrors-orphan-cleanup→main· +117 −1 · 2 files · 1 commits · openWhat it changes
VICTORY_CARD_CPU_FILE=1backs two-sided CPU mirrors withtempfile::tempfile_in(FILE_FLAG_DELETE_ON_CLOSE), which cleans up automatically on normal exit or process crash, but leaves orphaned.tmp*files behind incache/cpu-mirrorsafter a Windows BSOD or hard power loss. Over repeated unclean shutdowns this can accumulate thousands of stale files (gigabytes of disk space).fileback::cleanup_orphans(folder: &Path) -> (usize, u64)incrates/victory-gpu/src/fileback.rs, invoked once fromshadow::cpu_mirror_files(crates/victory-gpu/src/shadow.rs) when the mirror directory is configured.tempfile's.tmpprefix (len > 4); live mirrors held open by another running instance (tempfile::tempfile_inopens withshare_mode(0)so removal fails cleanly), directories, symlinks, and unrelated files are left untouched.How it was tested
--fg-type fsr --framegen 3), ray tracing off,VICTORY_SAMPLED_EVICT=1,VICTORY_WINDOW_GROW=1..tmp*files permanently incache/cpu-mirrors(3,700stale files /995.5 MBpresent on disk before first launch with this fix).removed orphaned file-backed CPU mirror temp files on startup removed=3700 mb=995, freeing3,700orphaned.tmp*files (995.5 MB) cleanly;cache/cpu-mirrorsstayed at0orphaned files across subsequent launches and a full 12-minute (720.7 sin-world) live soak (0crashes,0Victory errors)..tmp*cleanup, preservation of non-.tmpfiles and subdirectories, clean skipping of in-useMappedStoragehandles, and graceful handling of missing directories.cargo testpassed for the crates it touches: yes (on7c7d567c, base7d93ee0759)cargo test -j 2 -p victory-gpu --locked --lib fileback::tests: 5 passed, 0 failed (new:cleanup_orphans_removes_unlocked_tmp_files_and_preserves_other_entries,cleanup_orphans_skips_in_use_mapped_storage_without_error,cleanup_orphans_ignores_missing_folder)cargo test -j 2 -p victory-gpu --locked --lib shadow::: 84 passed, 0 failed, 6 ignoredcargo clippy -j 2 -p victory-gpu --all-targets --locked -- -D warningsand--all-features: 0 warnings on7d93ee0759(note: currentmain5fabb46ehas 5 pre-existing clippy errors infont.rs/menu.rs/panel.rsfrom#4634, tracked in#4679/#4707).cargo xtask policy: 464 files ok (--staged: 2 files ok).Checked for overlap
fileback.rs,cpu-mirrors,VICTORY_CARD_CPU_FILE, andshadow::cpu_mirror_files; no open PR touchesfileback.rsor cleans up orphanedcpu-mirrorstemp files.@nidea1 on GitHub · 2026-12-01 12:33 UTC · original
Live post-crash startup verification on
7c7d567c(RTX 3060 Ti 8 GB (ReBAR off, driver621.40), 32 GB RAM, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off,VICTORY_SAMPLED_EVICT=1,VICTORY_WINDOW_GROW=1,VICTORY_POOL_SMALL=0,VICTORY_RIPE_BLOCKS=12— 5-minute (300 sin-world,357 stotal) live validation on a combined 15-PR release build overorigin/main(5fabb46eaf).):3,701orphanedcpu-mirrorstemp files (995.6 MB) on disk before launch.#4714immediately cleaned all of them in one pass:INFO victory_gpu::fileback: removed orphaned file-backed CPU mirror temp files on startup removed=3701 mb=9950cpu-mirrorsfiles (0 MB) remaining,0Victory errors, and0nvlddmkmevents.Caveat: verified in a combined 15-PR build (5-minute opening/cell session, not an isolated A/B).
@cloph-dsp on GitHub · 2026-12-01 18:51 UTC · original
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b(current main), head7c7d567c0bebcfca538127d9f59fc5ab00d5bf88. The PR's own change is two files:crates/victory-gpu/src/fileback.rs110/0 andcrates/victory-gpu/src/shadow.rs7/1.One thing to know before the numbers: this branch sits on an older main, so a two-dot diff against today's main also shows
menu.rs,panel.rs,font.rsandREADME.mdgoing back to the pre-F1-menu state (that is the merge base difference, not part of the proposal). I therefore read and checked only the two files above; the merge itself keeps main's version of the menu files because the branch does not touch them.All three tests are new on the base (
git grep -F <name> 5fabb46e -- .exit 1 for each):cleanup_orphans_removes_unlocked_tmp_files_and_preserves_other_entries,cleanup_orphans_skips_in_use_mapped_storage_without_error,cleanup_orphans_ignores_missing_folder.git diff --check "5fabb46e..7c7d567c" -- crates/victory-gpu/src/fileback.rs crates/victory-gpu/src/shadow.rs→ no output, exit 0.Result, each:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1201 filtered out.What they cover, from the bodies: the first builds a temp tree with two
.tmpXXXXXXXXorphans plus the near misses (.tmpbare,other.tmp, asubdir, and a.tmpDirdirectory holding a nested.tmpNested) and assertscleanup_orphansreturns(2, 4096 + 123)— both counts and bytes — then that only the two orphans are gone; the second keeps aMappedStorageopen on a.tmpfile and asserts cleanup neither errors nor removes it; the third calls it on a path that was never created and expects(0, 0).The caveat: the first test probes the symlink arm opportunistically (
symlink_fileresult captured ashas_symlink), so on a machine without the privilege to create symlinks that part is skipped rather than passed.Temp dirs only, no title files, no device; GPU/driver N/A. No game data.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.