XGameSave: an old version another process holds open no longer fails the save #1836
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by adamMasMusic on 2026-11-24T23:11:10Z.
currentremoves 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
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:46Z.
Review: COMMENTED
Static review only: victory-hle is Windows-only — nothing compiles on macOS; source review of the diff.
XGameSave: old version held open by another process no longer fails…: file-sharing flags on save enumeration. Windows-only.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:37:01Z.
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
Imported from Marvisak/VIctory. Originally posted by WerG0D on 2026-11-25T01:56:17Z.
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
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.