warm: report compiler process stack overflows (merzleckeier's branch, opened from a free slot) #2656
Closed
github-bot
wants to merge 2 commits from
github-bot/gh-2656 into main
AGit
pull from: github-bot/gh-2656
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2656
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2656"
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?
@fiestorra on GitHub · 2026-11-29 22:55 UTC · original
fiestorra:mw/warm-stack-overflow-diagnostic→main· +124 −10 · 1 files · 2 commits · closed without mergingOpening this on behalf of merzleckeier, whose account is blocked from opening an upstream pull request at its own open-PR limit (#2621). The branch, the commit and every line of the change are theirs:
fix/warm-stack-overflow-diagnostic,02de3303a("warm: report compiler process stack overflows", rebased from their3098f5ffdonto currentmain). If you would rather open it yourself, say so and I will close this one.What it does
d3d12/apps/leonida/src/warm.rs, one file, +113/-9: theleonida warmsubprocess supervisor reads the child's stderr for Rust's stack-overflow diagnostic (… has overflowed its stack) and, when it sees it, ends the child and reports "compiler process stack overflow" instead of waiting out the no-progress watchdog and calling it a timeout.Why it matters for #2621
The reporter's log says
thread 'main' has overflowed its stackfor 36 of 83,159 pipelines, while the supervisor reports a timeout. Those are two different failures, and a log that cannot tell them apart sends the next reader after the wrong one - which is what happened to me when I first answered the issue.It also matters that this change is not a fix for the pipelines: it makes the failure legible. The compiler-side overflow is still undiagnosed.
Evidence, from the author
Their measurements, quoted rather than repeated as mine: synthetic subprocess A/B where the old supervisor reported a timeout for a child that emitted the overflow line and stayed alive, and the new one reported the overflow and ended the child before the watchdog deadline; removing only the early termination made that regression test fail. The Windows x64 CLI test binary under Wine 11.22 passed 36/36 on the base and 39/39 with the change. The branch adds its test inline in
warm.rs(#[cfg(test)]), so the regression lives with the code.What I checked here, and what I could not
Not verified by me: the Rust tests themselves - this machine has no
cargo, sod3d12/does not build here, and I am not going to claim a green run I did not do. That is also why the body quotes the author's numbers instead of replacing them.AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. Where and on what: the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it.
Written with an AI assistant.
warm: 36 host pipelines die with "thread 'main' has overflowed its stack" (even with 64 MB), game then waits 10 s per frame and faces stay black (Linux, Wine + vkd3d-proton, RADV) #2621@fiestorra on GitHub · 2026-11-29 22:56 UTC · original
One thing a reviewer of this pull request should know: it will have no Rust test signal until #2648 lands.
The checks on it right now are the general ones (
change-scope,no-game-data). No workflow in.github/workflowsbuilds or testsd3d12/today - that is the gap #2648 fills ("D3D12 runtime",windows-latest,cargo test --workspace --exclude xtask) - so the only test evidence for a change towarm.rsis the author's own run:which is a good measurement and belongs to merzleckeier, not to CI. Nobody approving this should believe the green tick covers it.
What that means practically:
I verified what I could without
cargo: the branch merges cleanly withmain452d1d1b6, it is one commit and one file, and the regression test is inline inwarm.rsunder#[cfg(test)]rather than missing.Written with an AI assistant.
@merzleckeier on GitHub · 2026-11-29 23:09 UTC · original
Thanks for opening this and crediting the branch. Let's keep the review here.
MEASURED. I rebuilt the Win64 CLI test binary from this PR's exact GitHub merge
a0e6accb8(3098f5ffdinto452d1d1b6). Under Wine 11.22 on CachyOS, all 39 tests passed. The synthetic overflow case reported the error before the watchdog deadline, and the silent-child control still reported a timeout. Both cases verified that the supervisor retained the completed pipeline record.The run used CPU-only fixtures. Hosted native Windows Rust coverage is pending in #2648. AI-assisted with OpenAI Codex.
@fiestorra on GitHub · 2026-11-30 00:35 UTC · original
The
semantic-testsfailure on this pull request is inherited frommain, not from the change.main(b8bd37111) still has the interp oracle failing, so a branch cut from it inherits that job failing whatever it contains:#2633 carries the fix and is green on its own. Two ways to clear it here, and I did not take either because this branch is not mine:
a3b5ebea1to this branch, which is what I did on my own pull requests - it is the same commit#2633carries, and it becomes a no-op the moment that lands.The reason it is worth saying out loud: nothing in
warm.rscan affect a translator test, and a red tick that is not about the diff is the kind of thing that gets a pull request closed by someone skimming.Still true:
#2656has no Rust test signal until #2648 lands, so the only evidence for the change is your measurement (36/36 base, 39/39 with it, Wine 11.22).Written with an AI assistant.
3098f5ffd1to02de3303af@fiestorra on GitHub · 2026-11-30 11:43 UTC · original
Rebased onto current
main(d367675c7) after thesemantic-testsfailure. Head is now02de3303a, one commit, and the test that failed passes here.What was failing and why:
This branch does not touch that test - its only file is
d3d12/apps/leonida/src/warm.rs. The test came from its base, which is 216 commits behind:c717967d0("test(semantic): align computed-I/J f16 interp oracle with toward-zero p2 narrow") is not an ancestor of the merge base, so the branch ran the pre-fix oracle.After the rebase, on this machine:
What the rebase changed: nothing in this branch's own code - the one commit (
warm: report compiler process stack overflows,113 insertions, 9 deletionsinwarm.rs) applied cleanly; the base moved forward and the inherited test is the corrected one.What I did not verify: the Rust build. There is no
cargoon this machine, sowarm.rshas not been compiled here - thesemantic-testsjob and the Rust CI are the ones that will say.Why I did it rather than asking: the failure was not this branch's, it was its age, and a rebase is the whole fix. If you would rather keep the head you had (
3098f5ffd), say so and I will put it back - the previous commit is unchanged and pushed nowhere else.Written with an AI assistant.
@OreoFR on GitHub · 2026-11-30 18:00 UTC · original
RUN - native Windows red/green (Verified by OreoFR) - Intel Core Ultra 7 155H, Windows 11 Pro 10.0.26300, CPU only.
afb511541; green = main + this PR at02de3303a(git merge --no-ff, clean, merge tree39b48b4c7).rustc 1.98.1 (48a229cea 2026-09-01),x86_64-pc-windows-msvc, pinned byd3d12/rust-toolchain.toml. Native Windows, not Wine.d3d12/, one worktree and onetarget/per arm):cargo test -p leonida. No feature flags or--ignoredare needed. The new tests are plain#[test], and the fixture re-runs the test binary itself.Result: PASS (green). A strict red cannot be built, so I ran a substitute red, described below.
leonidabin unit teststests/agility.rstests/census.rsafb511541warm::tests::reports_stack_overflow_before_waiting_for_the_timeout,warm::tests::silent_child_still_times_out, and the helperwarm::tests::warm_child_fixture(a no-op unlessLEONIDA_TEST_WARM_CHILDis set). All three pass natively.collect_child, which this PR adds, so with main's codecargo teststops witherror[E0425]: cannot find function 'collect_child' in this scope(warm.rs:264).reports_stack_overflow_before_waiting_for_the_timeoutthen fails atwarm.rs:320: left(1, Some("hung for 8 s")), right(1, Some("compiler process stack overflow")). The other two tests still pass. So on native Windows the new test catches the loss of the early detection, as the author found under Wine.hung for 2 s. Both cases keep the one pipeline record that was finished.Not covered:
leonida warmrun against a pipeline cache, and no game run.This run was AI-assisted (Claude Code, oreofr-agent).
@MoonEyes on GitHub · 2026-11-30 19:14 UTC · original
RUN · VERIFY-2656-RTX4060 · by MoonEyes (another person than the author) on head
02de3303a, with #2674 (be2a1ab0f) and #2656 (02de3303a) merged intomain8f41d7d01. Windows 11 Pro 26300, RTX 4060 8 GB,-SeriesS -FrameGen 2, diag build.cargo test -p leonida-pipeline --locked: 8 passed;cargo test -p leonida --locked: 46 passed; 0 failed.AI-assisted (Claude Code).
@fiestorra on GitHub · 2026-12-01 08:53 UTC · original
done: rebased onto today's
main, which is where it was conflicting, and the resolution is not the obvious one - taking main'sstderr(Stdio::null())would have made this branch report nothing at all.mainad7c62edb, one commit,warm.rsonly.git merge origin/mainconflicted inchild, becausemaingave it a store:The stderr is the whole point of this branch, and not only for the diagnostics:
collect_childstarts withso with
stderr(Stdio::null())there is noprocess.stderrto take and the function returns before reading anything. The merge keeps main's signature and the--storeargument and keeps stderr piped, with a comment saying why.Verified on the merged tree:
The one warning in that build is
unused doc commentatcrates/leonida-shader/src/emit/lower.rs:1716, which is not this branch and not this file.What I could not test: the behaviour the branch is for - a compiler child hitting its stack guard. That needs the title and a driver that overflows; what I verified is that the merged code compiles and its unit tests pass.
AI-assisted: yes - DeepSeek v4.1 (flash), which found the conflict by polling its own pull requests rather than by being told.
Written with an AI assistant.
@KelboLive on GitHub · 2026-12-01 14:19 UTC · original · reviewed
Reviewed at
2a6dfff4f. The claim matches the code: stderr is piped instead of null (warm.rs:353-359),collect_childmatchesthread '…' has overflowed its stack, sets the flag and kills the child (:400-407), and the overflow is preferred over the status/hung result once the reader returns (:434-436), so the outer loop marks the pipeline bad instead of waiting outLONGEST.cargo test -p leonidais 50/50 here.The regression test genuinely guards the early exit: flipping only the matcher suffix makes it fail with
(1, Some("hung for 8 s"))against the expectedcompiler process stack overflow.git merge-tree --write-tree origin/main pr/2656is clean (9d4a7fd80).One nit:
child()no longer useseachdirectly, somut eachatwarm.rs:335now warns (variable does not need to be mutable) — drop themut. The synthetic-diagnostic caveat (the test feeds a crafted line rather than a real overflow) is already stated in the body, and the base being 216 commits behind is harmless here:warm.rsmoved only once since then (thecount % 1000→is_multiple_ofline), so the logic reviewed is the logic that will land.@merzleckeier on GitHub · 2026-12-01 14:37 UTC · original
I followed up on the warm.rs review at
2a6dfff4+cd0c52fcf. The Win64 app test build reproduced theunused_mutwarning inchild. Removingmutfromchild'seachparameter removes that warning. The binding incollect_childstays mutable, where the callback is called.I also added a local negative control for stderr matching. A synthetic child prints one line with a warning prefix before the overflow phrase and one with extra text after it, then stays alive. The supervisor still reports
hung for 2 sfor that child. The exact diagnostic still reportscompiler process stack overflowbefore the eight-second watchdog, and the quiet control still times out. All four warm tests passed, including the fixture.MEASURED with the Win64 MSVC target under Wine 11.22, using synthetic subprocesses. No actual stack overflow was required. AI-assisted (Codex).
@fiestorra on GitHub · 2026-12-01 23:30 UTC · original
Closing the gap the body above left open: "Not verified by me: the Rust tests themselves - this machine has no cargo". It has one now, and they pass.
Applied on
main913b88b90:(
--bins, not--lib:apps/leonidais a binary crate, so-p leonida --libanswers "no library targets found" - which is what my earlier attempt did, and is worth knowing for the next person who tries to run these.)One thing to fix before merge: the change adds a clippy warning.
:335ismut each: impl FnMut(usize, f64, bool)infn child: the body never needs the binding to be mutable. Dropping themutis the whole fix. This repository has been keeping that at zero (which is what #2877 is about), so a new one would be the first back.What I cannot test: the case it reports - a compiler child that overflows its stack at 7 minutes on an 8 GiB card. No 8 GiB card here and no game run, so what is verified is that the supervisor's own tests pass and that a silent child still times out.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
@imShangLi on GitHub · 2026-12-02 05:33 UTC · original
VERIFY-2656 — Linux, Fedora 45, Rust 1.98.1, cross-compiled for x86_64-pc-windows-gnu, Wine 11.21, no GPU device, no game files
Verdict: PASS. The pull request makes the shader-compiler watchdog report a real cause — a compiler stack overflow read off the child's stderr — where the base threw that stderr away and misreported the same failure as a generic hang. I reproduced both behaviours side by side under Wine, and the whole
leonidasuite shows no regression.Head
2a6dfff4f879, base the currentmain(8422def759cda), merge basead7c62edbdee, 1 file, +124/−10:d3d12/apps/leonida/src/warm.rs.1. What it changes
The compiler is spawned as a child in
child(). On the base that child's stderr was discarded and never read:A stack overflow prints
thread '<name>' … has overflowed its stackon stderr, so on the base that diagnostic went to nowhere. The pull request:stderr(Stdio::piped())), and moves the whole "spawn, watch, reap" body into a newcollect_child(process, total, quiet_limit, each)so it can be tested;MAX_DIAGNOSTIC = 4096bytes andskip_until-ing the rest of an over-long line) and matches the overflow signature:quiet_limitthrough the watchdog (lock(&heard).elapsed() > quiet_limit) in place of the hardcodedLONGEST, so the tests can use a short limit.This is a root-cause fix, not a workaround: the bug was "the diagnostic channel was thrown away", and the change plumbs it through.
collect_childis a clean extraction and the watchdog limit becomes a parameter rather than a test-only hack.2. The new test checks the property that matters
The old code could not report an overflow even in principle — it never read stderr. So the meaningful question is whether the new code detects the overflow and whether the old code really lost it. I answered both with one scratch program under Wine that contains the base
child()and the PRcollect_child()verbatim (only the compiler command swapped for a fixture that prints progress on stdout, then an overflow line on stderr, then stays alive), and runs both against the same fixture:Same stdout progress parsed on both sides (
made=1, the(7, 2.0, true)callback), so the change does not disturb the existing progress path. But the reason for the failure is completely different: the base misreports a compiler stack overflow ashung for 8 s, and the pull request names the real cause. That is the property the pull request claims, demonstrated on the old code and the new code.The pull request's own tests cover the same property and pass here:
reports_stack_overflow_before_waiting_for_the_timeout— asserts the result is(1, Some("compiler process stack overflow"))andstarted.elapsed() < quiet_limit, i.e. the stderr reader ended the child before the watchdog could;silent_child_still_times_out— asserts a silent child still reportshung for 2 s, so the watchdog path is preserved;warm_child_fixture— the re-spawned fixture (returns early unlessLEONIDA_TEST_WARM_CHILDis set, which is exactly how the other two invoke it).Running the three directly in the PR's unittests binary under Wine:
The 3.00 s is real work, not an early
return:silent_child_still_times_outparks ~2 s waiting for its short watchdog, andreports_stack_overflow…waits for the stderr reader to kill its child. Neither is a device-gated test, so trap 1 (a test that returns early without testing) does not apply to them.3. What the tests do here
tools/wine_red_green.py 2656 --crate leonida. The red side (merge base + only the PR's test changes) does not compile — the new tests callcollect_child, which only the pull request adds — so the tool falls back to "merge base vs green", which is the right check here: does the head turn any test that passes on the base red?warm::tests::warm_child_fixture,warm::tests::reports_stack_overflow_before_waiting_for_the_timeout,warm::tests::silent_child_still_times_out— allokAgainst the repository's rule "a new test that fails on
mainand passes with the pull request": the new tests cannot compile onmain(they callcollect_child), and I showed separately that the old code really has the bug (base →hung for 8 s), so the spirit of the rule holds even though the literal red side cannot build.4. Any failure I saw, and why it is not this pull request
None. No test failed on either side, so there is nothing to attribute. The only build failure was the expected red-side compile error (the tests reference
collect_child, absent on the base), which is why the tool fell back to base-vs-green.5. What I did not check
thread 'main' (36) has overflowed its stack. I tried to trigger a genuine overflow under Wine to confirm the literal string, but a main-thread overflow on Wine aborted with an empty stderr and hung (my scratchwin_overflow_demohit the 90 s timeout with no message), so the exact wording of a real overflow is assumed, not measured. The parser's two anchors (thread 'prefix,has overflowed its stacksuffix) match the fixture, and this is the standard Rust panic message, but I did not verify it from a real overflow.skip_untilhandle over-long lines by construction, but I did not run them against real stderr traffic.LONGESTproduction value (600 s) was only exercised through the tests' shortquiet_limit; I did not wait out a real hang.@MoonEyes on GitHub · 2026-12-02 12:18 UTC · original
Closing: this pull request no longer applies to current
main(merge conflict ind3d12/apps/leonida/src/warm.rs), and open pull requests that have fallen out of step withmainare being closed so the list stays workable. If you still want this change, rebase it on currentmainand reopen it (or open a new pull request); it will be looked at again.AI-assisted (Claude Code).
Pull request closed