kernelx: a lazy physical page whose commit fails leaves the lazy set, silently #467
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#467
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@requiemsnkrp on GitHub · 2026-11-24 00:42 UTC · original
On
main(2997c9a),lazy::commit(crates/xcl/src/hle/kernelx/lazy.rs:39-45) removes the page fromLAZY(l. 41) beforeVirtualAlloc(MEM_COMMIT)(l. 44). When that commit fails –ERROR_COMMITMENT_LIMITnear 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:EXCEPTION_CONTINUE_SEARCH: the title dies with0xc0000005on a page that staysMEM_RESERVE;lazy::ensure(l. 87-101, used for DirectStorage destinations,dstorage.rs:726) has the same path. The request then fails with0x89240009(#333, run 2);This is not the race #244 fixed: there the page ends up committed, here it never is.
Proposed (small, one PR):
LAZYonly once the commit succeeded.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).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).
github-bot referenced this issue2026-11-26 04:23:14 +00:00
github-bot referenced this issue2026-11-26 04:59:09 +00:00
@Grimkaaah on GitHub · 2026-11-24 00:58 UTC · original
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 on GitHub · 2026-11-24 01:17 UTC · original
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
main2997c9aand 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 on GitHub · 2026-11-24 02:02 UTC · original
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 #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 #487 from one hit; it looks like an intermittent title-texture test.2997c9aandmain508a0c7for 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 on GitHub · 2026-11-24 03:52 UTC · original
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 descriptioncheckmainbf21bcbbd7b9e4be9423cDifferences 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 #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 #488 does;commitwould then commit that test's memory. Reserving two pages and releasing only the second one, or using #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.