fix(crash): an uncaught C++ exception at Windows' commit limit shows as out of memory, not an unexpected error #1056
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1056
Loading…
Reference in a new issue
No description provided.
Delete branch "d4nkn3ss/Longshot:fix/crash-window-commit-limit"
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?
Type: fix · Risk: low · Tested on: Windows 11, RTX 3080 · Needs: Linux, any GPU
Why
Players whose game ran out of memory are told "An unexpected error" by the crash window, not that their PC ran out of memory and what to do about it. Six recent reports end with
exception: 0x20474343: #1029, #1030, #991, #981, #964 and #894. That code is llvm-mingw's for a C++ exception nothing caught, and here it was thrown in the renderer. Five of their logs had reached Windows' commit limit (RAM plus the page file) just before:mem: commit of 0xc0000 bytes at the commit limit made after 50 ms (7 so far);vk: commit limit near: 47 MB of commit left;So the likeliest throw is a failed allocation. The crash window's log reader counts
mem: Windows is out of memory ...and a failed commit (error 1455), but neither of these lines. The diagnosis is on #1029. Row 5.6 of the worklist (memory over play time) is where this sits.This branch builds on #1012, whose commit (
test_crash_dialogruns on Windows) it carries first: without it the check can't run on Windows at all. Merge #1012 first; this PR's own change is the last two commits.How to reproduce
Seen on: Windows 11, RTX 3080 (NVIDIA 621.14), with the crash window shown from files (as a start shows a crash record)
Settings and switches: none
Steps: a crash record with
reason: unhandled exception,exception: 0x20474343, and its run'slongshot_log.txt(the record'srun_idin it) holding the two commit-limit lines above;longshot --crash-show crash-<UTC>.txt <game folder> <log> <options>Expected: "What went wrong: Your PC ran out of memory. ..."
Actual: "What went wrong: An unexpected error."
What changed
The crash window's log facts note when the process had reached the commit limit. With this exception code that makes the cause memory, so the window shows the out-of-memory advice. Another exception at the limit, or this one further from it, stays "An unexpected error".
host/hos_crash_dialog.h:HosCrashLog.commit_limit: set by a commithost/mkw_glue.cmade "at the commit limit", or by the renderer's commit reserve with 512 MB or less left (vk: commit limit near: N MB of commit left);hos_crash_cause:r->code == 0x20474343withcommit_limitreturnsHOS_CAUSE_MEMORY.tests/test_crash_dialog.py: verdict cases for that exception with a commit made at the limit (memory), 48 and 512 MB left (memory), 1719 MB left (unknown), no commit lines (unknown), and an access violation at the limit (unknown). They fail on main.Measurements
Verdict: fixed: the same crash record and log show "Your PC ran out of memory" with this PR and "An unexpected error" on main.
Hardware: Windows 11 Pro 26300, RTX 3080 10 GB (NVIDIA 621.14), i9-12900K, 64 GB
Scene: the crash window only, from a scratch game folder: one record and one log as above
Method: each build's
longshot.exe --crash-show crash-20261115T120000Z.txt <folder> <log> <options>, its window capturedBaseline: main's side is main @ 1764fed2's build; this PR was on
1764fed2when built and is rebased ontobbe421f5since.git diff 1764fed2 bbe421f5 -- host/hos_crash_dialog.h host/hos_crash_dialog.cis empty.How to reproduce: the steps above
1764fed2e3e97ec30x20474343, the log at the commit limitSeen on the way, not changed here: at this screen's scale both builds cut the third button's label to "pen the log fold" ("Open the log folder").
Flags and settings
None
Testing
Tested:
python -I -B tests/test_crash_dialog.py: the new cases fail on #1012's branch without the fix (at the first one, a commit made at the limit) and pass here.python -I -B tests/run_all.pyfrom PowerShell with llvm-mingw from the Longshot Builder: 599 passed, 18 failed, 42 skipped. The 18 are main's own:test_auto_handheld,test_bug_report_defaults,test_crt_options,test_fsr_uniform_ownership,test_guest_imported,test_import_reach,test_linux_preflight,test_make_game_cache,test_missing_nup,test_pads_after_menu,test_parallel_init_order,test_pending_guest_import,test_release,test_replay_write_order,test_run_all_changed,test_tested_configurations,test_vk_occlusion_queriesandtest_walk_key. Main also failstest_crash_dialog, which #1012 and this PR pass.Not tested: Linux, neither the build nor the window. The facts and the cause are plain C, and the exception code is llvm-mingw's (Windows): on Linux this rule never applies. A real crash at the commit limit: I can't make this PC's 64 GB run out.
Must be tested:
python -I -B tests/run_all.py test_crash_dialog, expecting it to pass (by hand: the check's line)Risks
What could break: a crash at the limit whose exception wasn't an allocation would now show the memory advice. Only this code at the limit is affected. An access violation there, or any other code, stays unknown.
Turning it off: revert the commit.
Compatibility: Nothing changes for players beyond these crashes' window text, and the Report's verdict with it.
Issues
See #1029, #1030, #991, #981, #964, #894
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Six crash reports (issue 1029, 1030, 991, 981, 964, 894) end with exception 0x20474343, llvm-mingw's code for a C++ exception nothing caught, thrown in the renderer, and five of their logs had reached Windows' commit limit first ("mem: commit ... at the commit limit made after ...", "vk: commit limit near: 47 MB of commit left"): an allocation that failed. The crash window called it "An unexpected error", so these players never saw the out-of-memory advice. New verdict cases: with that exception and a log at the limit (a commit made at it, or 512 MB of commit or less left) the cause is memory; further from the limit, or another exception there, it stays unknown. Fails on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>Six crash reports (issue 1029, 1030, 991, 981, 964, 894) ended with exception 0x20474343, a C++ exception nothing caught, thrown in the renderer, and five of their logs had reached Windows' commit limit first: an allocation that failed. The crash window said "An unexpected error", so those players never saw the advice that fits (close programs, a larger page file). The log's facts note the commit limit reached (commit_limit): a commit host/mkw_glue.c made "at the commit limit", or the renderer's commit reserve with 512 MB or less left ("vk: commit limit near: N MB of commit left"). With that exception code the cause is memory. Another exception at the limit, or this one further from it, stays unknown. Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in game: Windows 11, RTX 3080 (NVIDIA 621.14): the crash window of this build's longshot.exe and main's, shown with --crash-show from the same crash record (exception 0x20474343) and log (at the commit limit): main says An unexpected error, this build Your PC ran out of memory
WIP: fix(crash): an uncaught C++ exception at Windows' commit limit shows as out of memory, not an unexpected errorto fix(crash): an uncaught C++ exception at Windows' commit limit shows as out of memory, not an unexpected errorCode-only review of
e3e97ec3a5; informational findings, with final approval left to another reviewer.P2 — Historical pressure is treated as the cause of a later crash. In
host/hos_crash_dialog.h:197–199,commit_limitis only set, never cleared.read_log()inhost/hos_crash_dialog.cfeeds it the whole run, and line 312 turns any later0x20474343exception into the definite “Your PC ran out of memory” diagnosis. For example, the existing fixture'slog(near % 48, near % 1719)still returnsMEMORY, although the newer sample is above this PR's threshold. The other accepted line is emitted byhost/mkw_glue.c:34after VirtualAlloc succeeds on retry, so a recovered allocation also permanently sets this flag. The PR itself identifies this exception as generic C++, rather than identifying its thrown type.Please keep historical pressure separate from a confirmed allocation failure: use qualified “may have run out of memory” advice for this heuristic, or require sufficiently recent allocation-failure evidence before selecting the definite memory cause. If retaining a current-pressure flag, update it when newer headroom evidence arrives. Add a regression for low headroom followed by recovery and a later generic exception; the new tests only cover each headroom value independently. This is a source-derived diagnostic false-positive case, not a reproduced player crash.
The author reports Windows 11 / RTX 3080 crash-window A/B evidence and the new fixture passing, with 18 named existing suite failures. The requested Linux host build and crash-dialog check remain outstanding; I ran no tests, builds, or game. Those checks would validate portability, not establish the actual exception type in the six reports.
Merge coordination: 1012 is still open and supplies this branch's Windows fixture changes; merge it first as requested in the description. 983 and 141 also change crash-cause handling for Linux OOM reporting; preserve both rules when integrating. Reviewed the full diff, log producers/consumer, diagnostic text, relevant fixture paths, and existing feedback. No source changes or remote review actions made.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.