runtime: handle save name allocation failures #2701

Merged
louisdibiasi merged 2 commits from upstream-pr/2709 into main 2026-11-26 03:18:45 +00:00
louisdibiasi commented 2026-11-26 03:02:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-26T03:02:01Z.


Change

Follow-up to #2697. An allocation failure while copying a long container name in update_container returns E_OUTOFMEMORY through the save-action handler, but leaves its shared save lock held. Release the lock on that exception so later operations can proceed.

valid_name is also noexcept yet allocates when a name has a long stem; an allocation failure there terminates the process. Compare the reserved device-name stem through a string_view instead, preserving the existing validation rules without an allocation.

The source-built fixture injects failure into the container-name copy, checks the error and takes the lock exclusively without blocking, then retries the update. It also verifies validation of a long name without allocating. On the merged #2697 code, the lock check failed (fixture exit 24); the old allocating validator terminated the isolated child (exit 3). Existing tests cover accepted and rejected names, including reserved device names and the length limit. No application occurrence is claimed.

Verification

Windows x64, MSVC 19.44; head c4b3be58:

  • cmake --build --preset dev --target startup_gamesave_submit startup_gamesave_persist and ctest --preset dev --no-tests=error -R '^startup_gamesave_(submit_|persist)' --output-on-failure: 3 passed.
  • The same focused build and CTest filter with --preset release: 3 passed before the unrelated upstream merge; the affected files did not change in that merge.
  • cmake --build --preset pr and ctest --preset pr --no-tests=error: 34 passed, 4 MinLOD capability skips.
  • git diff --check upstream/main...HEAD: clean.

The first PR build attempt on upstream ed53c1fe failed in unrelated duplicate D3D12 member declarations; the rerun above includes the merged upstream repair #2706.

AI-assisted (Codex). Synthetic fixtures only.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6618559662 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2709). Originally posted by [louisdibiasi](https://github.com/louisdibiasi) on 2026-11-26T03:02:01Z. --- ## Change Follow-up to #2697. An allocation failure while copying a long container name in `update_container` returns `E_OUTOFMEMORY` through the save-action handler, but leaves its shared save lock held. Release the lock on that exception so later operations can proceed. `valid_name` is also `noexcept` yet allocates when a name has a long stem; an allocation failure there terminates the process. Compare the reserved device-name stem through a `string_view` instead, preserving the existing validation rules without an allocation. The source-built fixture injects failure into the container-name copy, checks the error and takes the lock exclusively without blocking, then retries the update. It also verifies validation of a long name without allocating. On the merged #2697 code, the lock check failed (fixture exit 24); the old allocating validator terminated the isolated child (exit 3). Existing tests cover accepted and rejected names, including reserved device names and the length limit. No application occurrence is claimed. ## Verification Windows x64, MSVC 19.44; head c4b3be58: - `cmake --build --preset dev --target startup_gamesave_submit startup_gamesave_persist` and `ctest --preset dev --no-tests=error -R '^startup_gamesave_(submit_|persist)' --output-on-failure`: 3 passed. - The same focused build and CTest filter with `--preset release`: 3 passed before the unrelated upstream merge; the affected files did not change in that merge. - `cmake --build --preset pr` and `ctest --preset pr --no-tests=error`: 34 passed, 4 MinLOD capability skips. - `git diff --check upstream/main...HEAD`: clean. The first PR build attempt on upstream ed53c1fe failed in unrelated duplicate D3D12 member declarations; the rerun above includes the merged upstream repair #2706. AI-assisted (Codex). Synthetic fixtures only.
upstream-sync closed this pull request 2026-11-26 04:04:28 +00:00
R0Y00 commented 2026-11-26 04:04:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T03:18:35Z.

Review: APPROVED


Verified from this head with MSVC Debug and /O2, using both the synthetic scheduler and the system Immediate queue (4/4). The long-name allocation injection returns E_OUTOFMEMORY, an exclusive lock is immediately available, and retrying the same update writes the data. The reserved-name stem comparison keeps its ASCII folding and space trimming without allocating.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6068099289 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2709#pullrequestreview-6068099289). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T03:18:35Z. **Review:** APPROVED --- Verified from this head with MSVC Debug and /O2, using both the synthetic scheduler and the system Immediate queue (4/4). The long-name allocation injection returns E_OUTOFMEMORY, an exclusive lock is immediately available, and retrying the same update writes the data. The reserved-name stem comparison keeps its ASCII folding and space trimming without allocating.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2701
No description provided.