runtime: handle save staging allocation failure #2697
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2697
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2697/head"
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?
@louisdibiasi on GitHub · 2026-11-26 02:23 UTC · original
louisdibiasi:louis/gamesave-stage-oom→main· +55 −15 · 3 files · 3 commits · merged 2026-11-26 02:50 UTCChange
When the staged-action vector cannot allocate, save slot 25 or 26 currently lets
std::bad_allocescape while holding the save lock. The update also charges the action's bytes before the action is kept. Return the existing out-of-memory result instead, and charge the bytes only after insertion succeeds. A later action can then be staged and submitted.The source-built submit fixture injects the vector allocation failure, checks the error, and retries a write through the ordinary dispatcher. Restoring the old staging code makes the controlled test fail. This covers that allocation point; it does not claim that a startup run encountered it or cover allocations earlier in the call.
Verification
Windows x64, MSVC 19.44, commit
bc37c682(basee76f8acd):cmake --build --preset dev --target startup_gamesave_submitandctest --preset dev --no-tests=error -R '^startup_gamesave_submit_' --output-on-failure: 2 passed.cmake --build --preset release --target startup_gamesave_submitand the same CTest filter with--preset release: 2 passed.686915eabefore the unrelated upstream fast-forward,cmake --build --preset prandctest --preset pr --no-tests=error: 34 passed, 4 MinLOD capability skips. The submit checks were rerun on the final base.AI-assisted (Codex). Synthetic fixture only; no title data or application run.
@R0Y00 on GitHub · 2026-11-26 02:45 UTC · original
Extended the staging fix to catch allocation failure while making the private copy of the blob, before the update holds its lock. Tested
53fe958bwith MSVC Debug and /O2, both the synthetic scheduler and the Windows system Immediate queue (4/4). The fixture injects separately at the action-list append and the blob copy, then retries the same update. With the pre-fix preparation code the new control exits 20 when bad_alloc escapes.