Skip to content

XGameSave: retry MoveFileExW on transient access/sharing errors (#2941) - #3017

Open
Lewandox wants to merge 1 commit into
xcl-dev:mainfrom
Lewandox:fix/gamesave-replace-file-retry
Open

Lewandox wants to merge 1 commit into
xcl-dev:mainfrom
Lewandox:fix/gamesave-replace-file-retry

Conversation

@Lewandox

@Lewandox Lewandox commented Nov 27, 2026 •

Copy link
Copy Markdown

Fixes #2941.

What is in it

  • Retry MoveFileExW(..., MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) in gamesave::replace_file up to 4 times (10 / 20 / 30 / 40 ms backoff, 5 attempts total) only on ERROR_ACCESS_DENIED (5) and ERROR_SHARING_VIOLATION (32), returning immediately on all other OS errors.
  • Add Windows regression tests covering transient destination/source locks (replace_file_retries_transient_destination_and_source_locks) and persistent-lock cleanup / missing-source fast failure (write_atomic_fails_cleanly_on_persistent_lock_and_missing_source).

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: Windows 11, NTFS, NVIDIA GeForce RTX 3050 Ti Laptop GPU (32.0.16.2140), rustc stable-x86_64-pc-windows-gnu, debug build.
  • cargo +stable-x86_64-pc-windows-gnu test -p xcl --lib hle::xgameruntime::gamesave::tests -- --test-threads=1: 13 passed, 0 failed, 0 ignored.

Regression run

  • No retail title available on this machine to run scripts/smoke.ps1; this change is scoped strictly to gamesave::replace_file error retries and unit tests. Ready for a test-only waiver or community smoke verification.

Not tested

AI use

  • Antigravity (Gemini 4 Neon) assisted with implementation, Windows/NTFS regression tests, and local verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XGameSave: a blob write fails with ERROR_ACCESS_DENIED when another process briefly holds the file (no retry in replace_file)

1 participant