HLE XGameSave: tolerate locked old or unfinished version cleanup #3104
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!3104
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3104"
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?
@fuzeofficlal on GitHub · 2026-11-26 08:12 UTC · original
fuzeofficlal:fix/hle-xgamesave-tolerate-locked-cleanup→main· +85 −5 · 1 files · 1 commits · openSummary
crates/victory-hle/src/modules/xgamesave.rs(current), treatstd::fs::remove_dir_allfailures when cleaning stale*.newstaging folders or olderv<old>committed versions as non-fatal (tracing::warn!and continue) instead of aborting container reads and blocking subsequent updates (e.g., when Windows AV/backup scanners temporarily hold a file in an older version folder without delete sharing).read_dir,load,commitstaging/rename, or missing readable manifests) continue to propagate unchanged.OpenOptionsExt::share_mode(0)verifying that reads, subsequent updates, and post-unlock cleanup all succeed when an old version or stale.newdirectory is locked.(Issue pattern originally noted in
fxceless/victory-fork6a42ed27; implemented cleanly againstmainwith Windows-native locked-file regression tests.)Verification
cargo test -p victory-hle --locked -- modules::xgamesave::: 13 passed, 0 failed.cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean.cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed.@Marvisak on GitHub · 2026-11-26 08:24 UTC · original
Automated triage for the maintainers.
Merge candidate. In
crates/victory-hle/src/modules/xgamesave.rs,currentnow logs and continues whenremove_dir_allfails on a leftover*.newstaging folder or an olderv<N>version. Before, a file held open without delete sharing (a scanner, a backup tool) made every read and update of that container fail. I checked that the cleanup is the only thing relaxed:read_dir,load,commitand the commit rename still propagate their errors.The two Windows tests lock a file with
share_mode(0)and check that reads and updates still work, and that cleanup finishes once the lock is gone. CI (check, windows-latest) passes.A note: a locked leftover named
v<highest+1>.newstill fails the next update.commitremoves that exact folder first and propagates the error, as on main. That is the usual crash leftover, so the test withv99.newsteps around it. It is not a regression, but a follow-up could commit to a fresh name in that case.Generated by Claude Code
@oni-swr on GitHub · 2026-11-26 08:28 UTC · original
Independent Windows CPU verification of PR #3104 at
c4509390cf(single commit, parent63bcca43c6= main). Claim: #1633 . Windows 11 x64, no GPU, no gamepad,cargo test --locked -j 4 -p victory-hle --lib xgamesave, isolated tempdirs only, synthetic data only..newversion).remove_dir_all(...)?fail both new tests with Windows error 32 (sharing violation), so the tests do exercise the change.v1and av50.newstaging dir. Repeated reads returned the newer committed version, update tov3succeeded, both locked dirs were left in place, and after release the next read removed both. With a zero-share lock on the active version's manifest: read and update both returned the same error (NO_ACCESS),v3was kept, nov4was created; after release, read and update worked normally.Not checked: source review, other platforms, clippy. Test report only; no source changes and no PR from me.
AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol).
@Dukestar69 on GitHub · 2026-11-26 08:30 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory-hle --lib modules::xgamesave:: -- --test-threads=1: 13/13 passed (includinga_locked_old_version_does_not_block_reads_or_updatesanda_locked_unfinished_version_does_not_block_reads_or_updates).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly tolerates locked old or unfinished version directories during XGameSave cleanup instead of failing reads/updates.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@futurepro62 on GitHub · 2026-11-26 20:01 UTC · original
NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head
c450939(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.a_locked_old_version_does_not_block_reads_or_updates,a_locked_unfinished_version_does_not_block_reads_or_updates.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 20:32 UTC · original
There is one remaining Windows retry case on
c450939plus the current #3329 head80e854a. A lockedv99.newlets the next write proceed because it usesv2.new. If the locked directory isv2.newitself, the read succeeds but the submit returns0x80830002. The same collision withv1.newkeeps a legacy save in the old layout even after its last unreadable blob is released.Candidate
6e9fd60leaves the occupied staging directory for the next cleanup and writes into the first free version. A normal update commits tov3and retains the untouched blob. A legacy save migrates tov2as soon as its original files can be read, with both blobs and the display name intact. In both cases, a later read removes the stale stage after its handle is released.Both focused regressions fail before the fix. With it, all 15 save tests and all 156 HLE tests pass on Windows, including the crash points. Strict HLE Clippy with and without diagnostics and the asset policy check pass. The tests use synthetic temporary saves.
@fuzeofficlal, could you review the version selection against your cleanup change? The commit has both exact PR heads as parents. If you fold the change into your branch, please keep the Git author or use
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.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.