Repository navigation
XGameRuntime: a save read sees all of an update or none of it - #2132
dhillonjagdeep650-boop wants to merge 1 commit into
Conversation
XGameSaveSubmitUpdate replaces an update's blobs one file at a time under SAVE_MUTATION, but XGameSaveReadBlobData (and its Async form) read the blobs without it. A read that ran during an update could return one blob from before the update and another from after it, and while it had a blob open, MoveFileExW could not replace that file, so the update failed with E_FAIL partway through. read_layout now takes SAVE_MUTATION, like apply and delete_container. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Independent native Windows check of exact PR head Tested
This checks the race regression and neighboring GameSave tests on this Windows machine. I did not run a pre-fix negative control here, the full workspace suite, or a retail title save operation. The short title startup available on this machine does not reach GameSave calls. No game data was used or uploaded. AI-assisted testing and report drafting with OpenAI Codex (GPT-6); I checked the exact revision, per-run log, and aggregate counts before posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Code review on
Remaining before merge: |
XGameSaveReadBlobDataandXGameSaveReadBlobDataAsyncread a container's blobs without the lock thatXGameSaveSubmitUpdateholds while it replaces them one file at a time. A read that runs during an update can return some blobs from before the update and some from after it. It can also make the update fail: while the read has a blob open,MoveFileExWcannot replace that file, andapplyreturnsE_FAILwith part of the update written (the half-applied state of #324, reached without a disk error). Found by reading the code and reproduced with a unit test; not seen in a title.What is in it
crates/xcl/src/hle/xgameruntime/gamesave.rs:read_layouttakesSAVE_MUTATION, asapplyanddelete_containerdo (one line, plus the lock's comment).reads_during_an_update_see_all_of_it_or_none: one thread reads two blobs in a loop while another rewrites both in 30 updates. It counts failed updates, reads whose two blobs come from different updates, and failed reads; all three must be 0.Tested
XCL_*variable set for the tests (LOCALAPPDATApointed at an empty folder, so that they could not touch a real XCL data folder).read_layoutline: fails 5 of 5 runs (failed updates / mixed reads per run: 13 / 37, 9 / 53, 5 / 42, 8 / 49, 8 / 25). With it: passes 5 of 5.cargo test --workspace --locked --no-fail-fast -- --test-threads=4on the tree ofa18c180(run before it was committed, unchanged since): 1155 passed, 0 failed, 46 ignored.main6020a33: 1154 passed, 0 failed, 46 ignored.no wave64cases, 3 per-lane cases refused as unsupported (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(needs Windows Developer Mode).Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 60, each run with an empty data root and its own copy of the same DXIL cache.mainfirst. Corrected 2026-11-25: this said "no input". The input was not controlled, and the logs show a press of A at 45 s in the PR's run and none inmain's, so the two frame counts are not of the same scene.A second run of each, in the opposite order, gave 447 frames for
a18c180(first press at 57 s) and 845 formain6020a33(first press at 34 s), bothexit: 0x0with 0 device removals and 0 crashes. 447 is under 80 % of 845. That run presents nothing from 26 to 52 s, before its press; so does a run of unmodifiedcbc296aon this machine (22 to 48 s, 434 frames), and the other runs have such a gap of 16 to 20 s, so I do not think it is this change, but one run each does not show it. I first put the spread down to pipelines compiling in the background; the logs have no large driver compile in those gaps. A pair with the same scripted input (XCL_PRESS_A_AT) is to follow.Whether the title reads a save in these 60 s is not known: I first wrote that it makes no XGameSave call, but those calls write nothing to the log. No file was written under
gamesavein any of the four runs.Not tested
XGameSaveEnumerateBlobInfo,XGameSaveEnumerateContainerInfo,XGameSaveGetRemainingQuota) still run without the lock. They open no blob, so they cannot block an update, but they can list a container partway through one. Not changed here.apply; neither locksread_layout.AI use
🤖 Generated with Claude Code