You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
kernelx: a lazy physical page whose commit fails leaves the lazy set, silently #467
On main (2997c9a), lazy::commit (crates/xcl/src/hle/kernelx/lazy.rs:39-45) removes the page from LAZY (l. 41) before VirtualAlloc(MEM_COMMIT) (l. 44). When that commit fails – ERROR_COMMITMENT_LIMIT near the system's commit limit, which the retail title reaches on 16 GB machines (#333: 0.44–0.98 GiB of headroom left in three runs) – then:
the page is no longer lazy, so the next fault on it is not retried, and the handler (l. 47-58) returns EXCEPTION_CONTINUE_SEARCH: the title dies with 0xc0000005 on a page that stays MEM_RESERVE;
nothing is logged, so the crash line looks like a wild write and not an out-of-memory.
This is not the race #244 fixed: there the page ends up committed, here it never is.
Proposed (small, one PR):
Remove the page from LAZY only once the commit succeeded.
Count failed commits and keep the last failing page and GetLastError() in atomics (no logging or allocation inside the vectored handler). The unhandled-exception filter (eh.rs) adds them to the crash line: lazy commit failed N times, last 0x… (1455 ERROR_COMMITMENT_LIMIT).
Test: a child test process in a job object with a process memory limit marks lazy pages past the limit. The touch must fail with the new crash line instead of a bare 0xc0000005, and a page under the limit must still commit.
Not a fix for running out of commit (#333 / #194 / #345), only an honest failure. Before I write it: does this fit, or would you rather have it folded into #194's memory line?
AI use: found while analysing #333 with Claude Code (Claude Opus 5.5).
PR opened: leave the page in LAZY until MEM_COMMIT succeeds, record failures for the crash line, and make DirectStorage refuse destinations that could not be committed.
Three PRs now implement this issue: #487, #488 and #502. As the issue's author, here is a side-by-side check to help pick one. All three are based on main2997c9a and merge into it cleanly. I built each head and ran its tests on an RTX 3060 / Ryzen 5 5600X / Windows 11 26200 machine, Rust 1.100.0, debug.
failure recorded without logging or allocating in the vectored handler
yes (atomics)
yes (atomics)
no: xlog_warn! in commit_with, which the handler calls
failure named in the crash line (eh.rs)
yes, AV only, error as a number
yes, error named (1455 ERROR_COMMITMENT_LIMIT)
no
test hits a real commit limit
no (commits at a released address)
yes (child process in a job with JOB_OBJECT_LIMIT_PROCESS_MEMORY)
no (injected failing allocator)
new test here
3 of 3 passed
failed 6 of 9 runs (below)
3 of 3 passed
hle::kernelx + hle::dstorage tests
38 passed
38 passed in that run
38 passed
PR checks
failing
failing
failing
What I checked, per PR:
kernelx: keep failed lazy commits in lazy set and report in crash line #488 is the closest to the plan in the issue, but its test is not stable here. Run alone (--exact) it failed 4 of 4 times: missing 0xc0000005 in stderr, and the child had ended with 0xc00000fd, "has overflowed its stack". With the job limit at PagefileUsage + 4 * PAGE, the crash path cannot grow its stack, so the child dies before the filter writes the line. Within hle::kernelx::lazy it failed 2 of 3 runs. The 64 KiB stack warm-up looks too small for that margin. The PR's own regression run reports frames shown: none logged, which pr_check.py reads as fewer frames than main.
kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487: the dstorage.rs hunk does not change behaviour. writable() already checks every page with VirtualQuery after ensure, so a page that stayed reserved already failed the request. The new test releases a reservation and then commits at that address. In a test process running other tests in parallel, another allocation can take that address in between, and the commit would then succeed into foreign memory (unlikely, but possible). The description has no Tested / Not tested / AI use sections and no regression run, both of which pr_check.py asks for.
kernelx: a lazy page whose commit fails stays lazy, and says so #502 logs from inside the vectored exception handler (format! plus the log file's mutex). It does so exactly when the system is out of commit, where that allocation can itself fail. It also leaves out the crash-line part. The author already says the diff was written with a model that CONTRIBUTING does not accept.
My suggestion, the maintainer's call: #488's approach with its test made reliable (more commit headroom in the job, or more stack committed before assigning it), and the atomics-only recording that #487 and #488 share.
AI use: comparison, builds and test runs done with Claude Code (Claude Opus 5.5) on the machine above; each point was checked against the diffs and the runs before posting.
Second machine for the three PRs on this issue, same heads as the comparison above (#487bf21bcb, #488bd7b9e4, #502be9423c; all three still merge cleanly into current main508a0c7). Each head built and tested as-is.
kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487: in its first run the lib tests had 3 failures: placed_title_textures_share_vram_and_preserve_pixels (cubemap extra_pages must be reused at same va, left 2359296, right 2555904), plus two tests that then panicked on its poisoned lock (transitions_apply_when_their_list_is_submitted, d32s8_targets_take_their_own_size_of_video_memory). It did not come back in 4 more runs of kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487 (3 × cargo test -p xcl --lib, 1 × whole suite) or 3 runs of the test alone; the base 2997c9a had 0 failures in 3 lib runs. I can't tie it to kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487 from one hit; it looks like an intermittent title-texture test.
Base 2997c9a and main508a0c7 for reference: 636 / 640 lib tests passed, 0 failed; main's whole suite 680 passed, 0 failed, 41 ignored.
I also checked two points of the comparison against the code and agree: #502's commit_with runs xlog_warn! from the vectored handler's call to commit (lazy.rs, handler), and in #487writable() in dstorage.rs already refuses a page that is not committed through its VirtualQuery loop, so the new early return there does not change the outcome.
Not tested
No regression run (scripts/smoke.ps1): I have no retail title.
A real commit-limit exhaustion in a title; only the PRs' own tests cover it.
NVIDIA / wave32-only GPUs.
AI use
Claude Code (Claude Opus 5.5) ran the builds and tests and drafted this report on the machine above; I checked each point against the diffs and the logs before posting.
Comparison of the three open PRs for #467 (#487, #488, #502), to help pick one.
All three fix the core bug the same way: commit checks LAZY.contains(&page) and removes the page only after VirtualAlloc(MEM_COMMIT) succeeds. Each one merges cleanly into mainf4ce27c. I read the three diffs before running them. They touch only lazy.rs, eh.rs and dstorage.rs. #488's test starts a child copy of the test binary itself, and none of them make network calls or read files outside the tests' own.
kernelx: keep failed lazy commits in lazy set and report in crash line #488's test is flaky here.failed_lazy_commit_stays_lazy_and_reports_in_crash_line failed in 8 of 10 runs when started on its own (cargo test -p xcl --lib failed_lazy_commit_stays_lazy). It also failed in the full lib run. When it fails, the child prints has overflowed its stack and nothing else, so the 0xc0000005 / lazy commit failed asserts fail on an empty stderr. The job limit is PagefileUsage + 4 * PAGE, measured before the job is set up. That leaves no room for stack growth or for the crash handler's own allocations, so the child dies of the limit before it reaches the report the test looks for. A test that depends on that margin will likely fail on CI machines too. (Caveat: my toolchain is x86_64-pc-windows-gnullvm, not MSVC, which can change stack use.)
kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487 is closest to the plan. It keeps atomics only in the handler and appends the summary only to the access-violation crash line. ensure now returns bool, so a DirectStorage destination that cannot be committed fails the request instead of being written while still reserved. Its test is deterministic: it commits on a released reservation, so the commit always fails. Two small points:
the test releases its reservation and then marks that address lazy. Another test thread could reserve the same address in between, and commit would then commit that test's memory. Reserving two pages and releasing only the second one, or using kernelx: a lazy page whose commit fails stays lazy, and says so #502's injected-allocator idea (commit_with), would avoid that.
Suggestion: take #487 once its description has the Tested / Not tested / AI use sections and a regression run. #488's error names could be folded into it. #488's test needs a margin that does not depend on the stack, or should become #502-style allocator injection. Close #502 per the model rule.
Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0 x86_64-pc-windows-gnullvm, debug, cargo test -p xcl --lib -- --test-threads=4 on each PR merged into mainf4ce27c. Not tested: the MSVC toolchain, cargo test --workspace, smoke runs, a real commit-limit failure under a title.
Written with Claude Code (Claude Opus 5.5). I checked each point against the diffs and the runs above.
Activity
Grimkaaah commentedon Nov 24, 2026
PR opened: leave the page in LAZY until MEM_COMMIT succeeds, record failures for the crash line, and make DirectStorage refuse destinations that could not be committed.
Made with Cursor
requiemsnkrp commentedon Nov 24, 2026
Three PRs now implement this issue: #487, #488 and #502. As the issue's author, here is a side-by-side check to help pick one. All three are based on
main2997c9a and merge into it cleanly. I built each head and ran its tests on an RTX 3060 / Ryzen 5 5600X / Windows 11 26200 machine, Rust 1.100.0, debug.bf21bcb)bd7b9e4)be9423c)LAZYuntilMEM_COMMITsucceedsxlog_warn!incommit_with, which the handler callseh.rs)1455 ERROR_COMMITMENT_LIMIT)JOB_OBJECT_LIMIT_PROCESS_MEMORY)hle::kernelx+hle::dstoragetestsPR checksWhat I checked, per PR:
--exact) it failed 4 of 4 times:missing 0xc0000005 in stderr, and the child had ended with0xc00000fd, "has overflowed its stack". With the job limit atPagefileUsage + 4 * PAGE, the crash path cannot grow its stack, so the child dies before the filter writes the line. Withinhle::kernelx::lazyit failed 2 of 3 runs. The 64 KiB stack warm-up looks too small for that margin. The PR's own regression run reportsframes shown: none logged, whichpr_check.pyreads as fewer frames than main.dstorage.rshunk does not change behaviour.writable()already checks every page withVirtualQueryafterensure, so a page that stayed reserved already failed the request. The new test releases a reservation and then commits at that address. In a test process running other tests in parallel, another allocation can take that address in between, and the commit would then succeed into foreign memory (unlikely, but possible). The description has no Tested / Not tested / AI use sections and no regression run, both of whichpr_check.pyasks for.format!plus the log file's mutex). It does so exactly when the system is out of commit, where that allocation can itself fail. It also leaves out the crash-line part. The author already says the diff was written with a model that CONTRIBUTING does not accept.My suggestion, the maintainer's call: #488's approach with its test made reliable (more commit headroom in the job, or more stack committed before assigning it), and the atomics-only recording that #487 and #488 share.
AI use: comparison, builds and test runs done with Claude Code (Claude Opus 5.5) on the machine above; each point was checked against the diffs and the runs before posting.
Toons29 commentedon Nov 24, 2026
Second machine for the three PRs on this issue, same heads as the comparison above (#487
bf21bcb, #488bd7b9e4, #502be9423c; all three still merge cleanly into currentmain508a0c7). Each head built and tested as-is.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4, 0 GPU tests SKIPPED on any run:--exact), 3 of 5 withinhle::kernelx::lazymissing 0xc0000005 in stderr, the child test process "has overflowed its stack" before the crash filter writes its line. So it is not specific to that machine.placed_title_textures_share_vram_and_preserve_pixels(cubemap extra_pages must be reused at same va, left 2359296, right 2555904), plus two tests that then panicked on its poisoned lock (transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory). It did not come back in 4 more runs of kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487 (3 ×cargo test -p xcl --lib, 1 × whole suite) or 3 runs of the test alone; the base2997c9ahad 0 failures in 3 lib runs. I can't tie it to kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487 from one hit; it looks like an intermittent title-texture test.2997c9aandmain508a0c7 for reference: 636 / 640 lib tests passed, 0 failed;main's whole suite 680 passed, 0 failed, 41 ignored.I also checked two points of the comparison against the code and agree: #502's
commit_withrunsxlog_warn!from the vectored handler's call tocommit(lazy.rs,handler), and in #487writable()indstorage.rsalready refuses a page that is not committed through itsVirtualQueryloop, so the new early return there does not change the outcome.Not tested
scripts/smoke.ps1): I have no retail title.AI use
lordon1a commentedon Nov 24, 2026
Comparison of the three open PRs for #467 (#487, #488, #502), to help pick one.
All three fix the core bug the same way:
commitchecksLAZY.contains(&page)and removes the page only afterVirtualAlloc(MEM_COMMIT)succeeds. Each one merges cleanly intomainf4ce27c. I read the three diffs before running them. They touch onlylazy.rs,eh.rsanddstorage.rs. #488's test starts a child copy of the test binary itself, and none of them make network calls or read files outside the tests' own.PR descriptioncheckmainDifferences that matter:
failed_lazy_commit_stays_lazy_and_reports_in_crash_linefailed in 8 of 10 runs when started on its own (cargo test -p xcl --lib failed_lazy_commit_stays_lazy). It also failed in the full lib run. When it fails, the child printshas overflowed its stackand nothing else, so the0xc0000005/lazy commit failedasserts fail on an empty stderr. The job limit isPagefileUsage + 4 * PAGE, measured before the job is set up. That leaves no room for stack growth or for the crash handler's own allocations, so the child dies of the limit before it reaches the report the test looks for. A test that depends on that margin will likely fail on CI machines too. (Caveat: my toolchain isx86_64-pc-windows-gnullvm, not MSVC, which can change stack use.)commitis called fromhandler, and kernelx: a lazy page whose commit fails stays lazy, and says so #502 addsxlog_warn!(formatting and a lock) on the failure path. The issue's plan asks for atomics only there, since the faulting thread may hold the heap or log lock. The description also says the diff was written by DeepSeek V4.1 Flash, which CONTRIBUTING.md does not accept.ensurenow returnsbool, so a DirectStorage destination that cannot be committed fails the request instead of being written while still reserved. Its test is deterministic: it commits on a released reservation, so the commit always fails. Two small points:(1455)), where the issue asked for the name too, as kernelx: keep failed lazy commits in lazy set and report in crash line #488 does;commitwould then commit that test's memory. Reserving two pages and releasing only the second one, or using kernelx: a lazy page whose commit fails stays lazy, and says so #502's injected-allocator idea (commit_with), would avoid that.Suggestion: take #487 once its description has the Tested / Not tested / AI use sections and a regression run. #488's error names could be folded into it. #488's test needs a margin that does not depend on the stack, or should become #502-style allocator injection. Close #502 per the model rule.
Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0
x86_64-pc-windows-gnullvm, debug,cargo test -p xcl --lib -- --test-threads=4on each PR merged intomainf4ce27c. Not tested: the MSVC toolchain,cargo test --workspace, smoke runs, a real commit-limit failure under a title.Written with Claude Code (Claude Opus 5.5). I checked each point against the diffs and the runs above.
kernelx: keep lazy pages on failed MEM_COMMIT (xcl-dev#467)