XGameRuntime: blob_enumeration_sees_one_submitted_update fails on Windows NTFS (DirEntry::metadata cache) #2421

Open
opened 2026-11-26 05:30:26 +00:00 by github-bot · 1 comment
Owner

@⁠Ritolino on GitHub · 2026-11-25 18:23 UTC · original

hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update (added in #2165) fails on Windows 11 (NTFS), both under .\scripts\test.ps1 (--test-threads=4) and when run standalone:

thread 'hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update' panicked at crates\xcl\src\hle\xgameruntime\gamesave.rs:1184:9: assertion left == right failed: 2 of 31 enumerations mixed submitted updates

Root cause

Both pply and each_blob hold SAVE_MUTATION, so lobs_of does not run concurrently with MoveFileExW. However, lobs_of (crates\xcl\src\hle\xgameruntime\gamesave.rs:121) reads file sizes via DirEntry::metadata(), which on Windows returns the size cached in the NTFS directory index entry (FindNextFileW), which can lag behind an atomic MoveFileExW replacement across adjacent files.

Using std::fs::metadata(e.path()) (or File::metadata) instead of DirEntry::metadata() should bypass the directory-entry cache, though crates/xcl/src changes require xcl-smoke runs on a real title.

**@⁠Ritolino** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/xcl-dev/xcl/issues/2421) hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update (added in #2165) fails on Windows 11 (NTFS), both under .\scripts\test.ps1 (--test-threads=4) and when run standalone: ` thread 'hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update' panicked at crates\xcl\src\hle\xgameruntime\gamesave.rs:1184:9: assertion left == right failed: 2 of 31 enumerations mixed submitted updates ` ### Root cause Both pply and each_blob hold SAVE_MUTATION, so lobs_of does not run concurrently with MoveFileExW. However, lobs_of (crates\xcl\src\hle\xgameruntime\gamesave.rs:121) reads file sizes via DirEntry::metadata(), which on Windows returns the size cached in the NTFS directory index entry (FindNextFileW), which can lag behind an atomic MoveFileExW replacement across adjacent files. Using std::fs::metadata(e.path()) (or File::metadata) instead of DirEntry::metadata() should bypass the directory-entry cache, though crates/xcl/src changes require xcl-smoke runs on a real title.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:30:26 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 21:10 UTC · original

Claiming this issue: reproducing and fixing the Windows NTFS DirEntry::metadata() cache race in hle::xgameruntime::gamesave::blobs_of, with regression verification.
AI use: Claude Code (Claude Opus 5.5).

**@⁠oni-swr** on GitHub · 2026-11-25 21:10 UTC · [original](https://github.com/xcl-dev/xcl/issues/2421#issuecomment-7174708895) Claiming this issue: reproducing and fixing the Windows NTFS `DirEntry::metadata()` cache race in `hle::xgameruntime::gamesave::blobs_of`, with regression verification. AI use: Claude Code (Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.