XGameSave: an old version another process holds open no longer fails the save #1838
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!1838
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1838"
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?
@adamMasMusic on GitHub · 2026-11-24 23:11 UTC · original
adamMasMusic:xgamesave-held-old-version→main· +70 −5 · 1 files · 1 commits · opencurrentremoves unfinished (v<N>.new) and superseded versions of a container whenever it reads one, and passed any failure on with?. So while another process had a file of an old version open, every read and every update of that container failed withNO_ACCESS, though the newest version was intact.On Windows that happens in ordinary use. A virus scanner or the search indexer opens files right after they are written, typically shared for reading but not for deletion. Unchanged blobs are hard links to the previous version's files, so a scanner reading the new version also blocks deleting the old one. On one Windows 10 machine (Defender on, data folder on an NTFS volume) the title's saves failed this way in every run, with os error 32 (sharing violation) and, beside it, os error 4395 (
ERROR_REPARSE_POINT_ENCOUNTERED) fromremove_dir_all. The containers kept growing stalev<N>folders that never went away. In 3 of 8 runs the title then stayed on its loading screen for good, right after the save at world entry failed. That is a correlation only, I have not traced the title's side.Change (
crates/victory-hle/src/modules/xgamesave.rsonly)current: removing an unfinished or superseded version is best effort (remove_stale). A failure is logged at debug level and the folder is left for a later look. The newest committed version is the container either way, so nothing the title sees changes.commit: removing a leftover staging folder and the final rename retry for up to a second (20 × 50 ms) while Windows refuses them with an open-handle error (5, 32, 4395). Any other error, or one that outlasts the retries, fails the update as before.Tests
New Windows test
a_held_old_version_does_not_cost_the_save. It holdsv1's manifest open the way a scanner does (shared for reading and writing, not for deletion) while an update commitsv2. The container then still reads, takes another update, keepsv1meanwhile, and removes it once the file is let go. Without the change the read fails (Os { code: 32 }).cargo test -p victory-hlepasses, including the kill-at-any-step test, andcargo clippy -p victory-hle --all-targets -- -D warningsreports nothing.#1729 also changes
current(which folders count as versions); the two should combine without trouble, one deciding what to remove and this one what a failed removal costs.🤖 Generated with Claude Code
@Marvisak on GitHub · 2026-11-25 01:37 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-hle/src/modules/xgamesave.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
@WerG0D on GitHub · 2026-11-25 01:56 UTC · original · edited 2026-11-25 02:15 UTC
I tested this on Windows with an NTFS volume and a synthetic save container. On the original base (
70564ae), holding thev1manifest open allowed thev2write to finish, but the next read failed with Windows error 32. On your patch (5b40efd), I could readv2, writev3while the handle was still open, and readv3after releasing it.I also rebased your change onto
940d32fand added a regression test for the interaction with the newer recovery code. Withv1held open, a validv2, and a malformedv3manifest, the test reads the data fromv2, writes and reopensv4, then verifies thatv1is cleaned up after the handle is released.cargo test --locked -p victory-hle --libpassed all 145 tests, including all 13 XGameSave tests. This covers container recovery; in-game checkpoint loading remains unverified.The integration branch is available if it helps with the rebase.
a750c55preserves your commit and resolves the conflict.451c654adds the combined test. Feel free to take either.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.