Windows 10: unwinds_like_the_system_walk fails about half the time (RtlCaptureStackBackTrace returns no frames) #742
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#742
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?
@steppergg on GitHub · 2026-11-24 09:14 UTC · original
crash::tests::unwinds_like_the_system_walkfails about half the time on this PC, on unmodified main8e79c80.Windows 10 22H2 (19045.6036), Rust 1.98.1, debug test build.
walked:RtlCaptureStackBackTracereturned 0 frames, so the test stops atassert!(walked.len() >= 4)before our unwinder's result is compared.--test-threads=1and 23 of 40 when run alone.I have not found why the system walk comes back empty, and have not tried Windows 11. No game data used.
AI-assisted (Claude Code); run on my machine.
@slint6614-dev on GitHub · 2026-11-24 09:34 UTC · original
Windows 11 data point: on the same unmodified main
8e79c80, Windows 11 (build 10.0.26300), Rust 1.98.1, debug test build, AMD Ryzen 5 9600X, running only this test from the built test executable (victory_loader-*.exe crash::tests::unwinds_like_the_system_walk --exact): 40 of 40 runs passed. SoRtlCaptureStackBackTracereturning no frames looks specific to Windows 10 (19045) or to that machine, not to the test itself.@andrewpozdnakov7-jpg on GitHub · 2026-11-24 09:36 UTC · original
Adding a second Windows 10 data point alongside the Windows 11 run above.
I reproduced this on Windows 10 x64 (19045.6456), Rust 1.98.1 (MSVC), at
8e79c80. In 40 separate debug test processes, the original test failed 27 times. Every failure had an emptyRtlCaptureStackBackTraceresult.With a test-only patch that checks three known caller frames, all 40 runs passed. All 25
victory-loadertests, Clippy with warnings denied, and the targeted release test also passed. The cause of the empty Windows stack trace is still unknown.AI-assisted. All checks used synthetic inputs.
Test-only patch for
8e79c80@EduBertozzi on GitHub · 2026-11-24 10:06 UTC · original
Third Windows 10 data point, and the first with its CPU named: Windows 10 Education 22H2 (19045), Intel i7-10700K, GTX 1060, Rust 1.98.1, debug test build. I ran
cargo test -p victory-loader --lib unwinds_like_the_system_walkon a branch with no loader changes.crash.rs:672:9panics with[], soRtlCaptureStackBackTracereturned no frames.So far, every Windows 10 report fails and the one Windows 11 report (AMD) passes. This is the first Windows 10 report that names its CPU, so a CPU-vendor cause can't be ruled out yet.
AI-assisted (Claude Code); runs on my machine.
@geiyiliyabumo on GitHub · 2026-11-24 10:23 UTC · original
Ready-to-merge test fix on a fork branch (since external PR creation is currently paused):
121412bonmainffe310e, test-only change incrates/victory-loader/src/crash.rs)Summary
crash::tests::unwinds_like_the_system_walkto call through four#[inline(never)]frames (level_a→level_b→level_c→capture_frames, withstd::hint::black_boxafter each nested call to prevent tail-call elimination) and deterministically verifyunwind(context.0):frames.len() >= 4with 4 distinct return addresses.frames[0..4]and the four helper functions throughRtlLookupFunctionEntry(image_base + BeginAddress) and asserts exact call-order match (handling thunks / incremental-link jumps cleanly).RtlCaptureStackBackTraceparity check whenever the OS returns frames (if walked.len() >= helpers.len()), so Windows 11 keeps full system-walk parity while Windows 10 no longer flakes whenRtlCaptureStackBackTracereturns0frames.Verification
Windows 11 Pro (
26100), Rust1.98.1(x86_64-pc-windows-msvc):cargo test -p victory-loader --lib --locked crash::tests::unwinds_like_the_system_walk -- --exact× 5 → 5/5 passedcargo test --workspace --locked→ 342 passed, 0 failed, 6 ignored (23 test suites)cargo clippy --workspace --all-targets --locked -- -D warnings→ pass (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings→ pass (0 warnings)cargo xtask policy(154 files ok) &git diff --check→ passAI-assisted; synthetic tests only, no game files.
@DrTardis1963 on GitHub · 2026-11-24 10:44 UTC · original
Root cause measured on Windows 10 22H2 (
10.0.19045.5794), Intel i7-9700K, RTX 3070 (32.0.16.1088), Rust1.98.1:Root cause
On fresh Rust test threads on Windows 10
10.0.19045,Rsp - TEB.StackLimit(gs:[0x10]) frequently starts around0x260..0x6c0bytes above the committed stack limit. InsideRtlCaptureStackBackTrace,RtlWalkFrameChainwalks caller frames toward higher stack addresses; when the stack proximity triggers the stackPAGE_GUARDmid-walk, Windows lowersTEB.StackLimitby0x1000andRtlCaptureStackBackTraceaborts and returns0frames (an immediate secondRtlCaptureStackBackTracecall then sees the expandedStackLimitand returns8frames). Ourunwind()reads via SEH/unwind tables directly and therefore still succeeds when the first OS walk returns[].Fix on fork (preserves full system-walk parity)
559756c5b617a68e698a82db895383c2ad386f77(crates/victory-loader/src/crash.rs, test-only+10lines)#[inline(never)] fn ensure_stack_headroom()(touches one4096-byte stack buffer withstd::hint::black_box) at the top ofunwinds_like_the_system_walkso the guard page is expanded beforeRtlCaptureStackBackTrace, keeping the fullassert!(walked.starts_with(&frames[..4]))parity check intact on Windows 10.Verification (after
559756c)victory_loadercrash::tests::unwinds_like_the_system_walk --exact: 100/100 passed (debug) and 100/100 passed (release)cargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings&--all-features: 0 warningsvictory-loader22/22 + 2/2 + 1/1;victory-gpu50/50 + 1 ignored;victory-hle94/94 + 1/1;victory-formats23/23 + 4 ignored;victory-core11/11;victory-pe7/7;victory-pipeline4/4;victory-game2/2;victory1/1;xtask4/4;victory-shader102/102 with SM 6.6valu_tests/waterfall_testsskipped per #84/#473).AI-assisted; synthetic tests only, no game data used.
@andrewpozdnakov7-jpg on GitHub · 2026-11-24 11:04 UTC · original
Independent retest of
559756con Windows 10 x64 against its parentffe310e. Both builds ran the originalunwinds_like_the_system_walktest with the unconditional system-walk prefix assertion. I ran 100 fresh processes per revision in each profile and alternated the order within pairs.ffe310epassesffe310eempty OS walks559756cpassesThe separate build artifacts had distinct hashes. The headroom change kept the full parity check enabled. All 22 loader library tests also passed in each profile on
559756c.AI-assisted. Verified with synthetic tests on Windows.
@EduBertozzi on GitHub · 2026-11-24 11:20 UTC · original
Both fork fixes, run on the Windows 10 machine from my earlier comment (Windows 10 Education 22H2 19045, i7-10700K, Rust 1.98.1, debug). Each binary was built from its branch on
ffe310eand run 40 times, interleaved main / DrTardis1963 / geiyiliyabumo, asvictory_loader-*.exe crash::tests::unwinds_like_the_system_walk --exact:mainffe310ecrash.rs:672:9with[]559756c(stack headroom)121412b(known caller frames)The two pass for different reasons:
559756ckeepswalked.len() >= 4and the full comparison. SoRtlCaptureStackBackTracereturned frames in all 40 runs here, on a machine where it came back empty in about half the runs without the 4 KiB touch. That fits the guard-page explanation.121412bskips the system comparison when the walk is empty. Going by main's rate, it probably compared against the system walk in only about half of its runs.So
559756cfixes the test and keeps it as strict as before.121412b's own check against known callers is still useful on its own, and the two could be combined.AI-assisted (Claude Code); runs on my machine, no game data.
@wbnm77 on GitHub · 2026-11-24 14:18 UTC · original
Independent AMD Windows 10 check of
559756c5b617a68e698a82db895383c2ad386f77on a Ryzen 7 5700X, Windows 10 Pro 22H2 build 19045.6466 and Rust 1.98.1 MSVC in debug. I ran the exactcrash::tests::unwinds_like_the_system_walktest 100 times per revision in fresh processes, alternating the order within each baseline and patch pair.Unmodified
ffe310eb2098e52169f4c44db5ffdabf43a72622passed 31 of 100. All 69 failures were empty Windows reference captures.559756cpassed 100 of 100. All 22 fork loader unit tests passed. The stack-headroom change keeps the minimum-frame and exact caller comparisons active. These tests used no game data. Codex (GPT-6) assisted with setup, testing and this report.@Lemontea0075 on GitHub · 2026-11-24 18:07 UTC · original
I independently reproduced this issue on another Windows 10 system.
Hardware and environment
Test results
Branch:
pr-362-testCommit:
1e33e88Command:
Repeated 20 times:
A captured failure showed:
The test also passed on an isolated retry after a failure.
The full workspace test reported 343 passed, 1 failed, 6 ignored. The only failure was this loader test.
The shader tests on the same branch passed:
This independently reproduces the intermittent empty
RtlCaptureStackBackTraceresult on Windows 10 build 19044.