Loader unit test gets an empty system stack walk on current main (Windows/Rust 1.98.1) #1012
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#1012
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?
@Demon12377 on GitHub · 2026-11-25 16:02 UTC · original
Reproduced on unmodified main
39731795d2in a separate checkout on Windows, Rust 1.98.1. The loader suite has 26 passing unit tests and one failure. The isolated failure also reproduces.Failure:
The failure is the
walked.len() >= 4assertion: RtlCaptureStackBackTrace returns an empty vector, before the custom unwinder's frames are compared. The same isolated test passes in an unchangedf85101bcheckout on this machine. crash.rs itself is unchanged between those revisions, so this may depend on another build/runtime or environment difference; the cause is not established.This also reproduces in the contribution branch #1001, with the identical 26/1 result. Reporting it separately rather than weakening the assertion or treating the failed check as passed. No game executable/assets or derived fixtures are needed for this repro.
@fladit123 on GitHub · 2026-11-25 17:57 UTC · original
I attempted to reproduce this on Windows 11 Pro 26H2 (build 26300.10075), ntdll.dll 10.0.26100.10068, Rust 1.98.1, x86_64-pc-windows-msvc.
The original, unmodified test passed in all 300 fresh-process runs:
d510ee43973179f85101bThe loader unit suites also passed in both profiles for all three revisions.
A standalone synthetic probe collected another 3,072 samples using the original capture arguments. All returned nonempty results, including 706 calls during which StackLimit decreased by 4 KiB.
This does not invalidate the reported failure, but stack growth alone was insufficient to reproduce it on my system. Since the negative control did not fail, I have not proposed a patch or weakened the original assertion.
Could you share your exact Windows build, ntdll.dll version, and any non-default Rust compiler/linker flags or environment variables used for the failing checkout? Those differences may help narrow down the cause.
No title data was used.
@KainanP on GitHub · 2026-11-25 18:16 UTC · original
I couldn't reproduce this on Windows 11. It looks like the same failure as upstream Marvisak/VIctory#742, which has a measured root cause and an upstream fix.
Environment: Windows 11 Home 10.0.26200.9974, ntdll.dll 10.0.26100.9974, Intel i7-14650HX, Rust 1.98.1 x86_64-pc-windows-msvc from
rust-toolchain.toml, unmodifiedorigin/maind510ee4, no extra RUSTFLAGS.crash::tests::unwinds_like_the_system_walk --exact --test-threads=1cargo test -p victory-loader --locked <same> -- --exact --test-threads=1cargo test -p victory-loader --locked -- --test-threads=1Likely cause (upstream #742). On Windows 10 (19044/19045), DrTardis1963 measured that a fresh Rust test thread often starts only
0x260..0x6c0bytes aboveTEB.StackLimit. WhenRtlCaptureStackBackTraceruns into the stack guard page partway through its walk, Windows movesStackLimitdown by 0x1000 and the call returns 0 frames. A second call right after returns 8. Several people counted it on Windows 10, all with Rust 1.98.1, Intel and AMD:Touching 4 KiB of stack before the walk (
559756c) brought this to 0 failures in every rerun. Our customunwind()doesn't rely on that walk, so it still returns frames. Every Windows 11 report there passed.That matches what I see. A standalone probe (no game data) walked 300 fresh threads down through their guard page, debug and release, calling
RtlCaptureStackBackTrace(0, 8, …)at each step. That was 13,038 calls, including 600 that movedStackLimitduring the call. None returned 0, so on this build the walk survives the guard-page fault. fladit123's 26300 results above fit this too.Microsoft's CaptureStackBackTrace/RtlCaptureStackBackTrace docs only say it returns "the number of captured frames". They don't say when it can return 0, and they don't say the function sets last-error, so
GetLastErrorwon't help here. The test's arguments are fine:FramesToSkip = 0,FramesToCapture = 8, well under the old 63-frame limit.About "passes on
f85101b". Betweenf85101band3973179,crash.rs,Cargo.lock, the root/loaderCargo.tomlandrust-toolchain.tomlare unchanged, and the loader crate only changed inconsole_insn*.rs. Since Windows 10 fails this intermittently (roughly 45–90% of runs in the counts above), a passingf85101brun doesn't show a difference between revisions unless each was run many times.Fix status. Upstream merged Marvisak/VIctory#1159 (
121412b). It checksunwind()against known caller frames and only compares with the system walk when that walk returned frames. That commit is already in this fork's open upstream-sync PR #653. #411 proposed the stricter headroom fix (559756c) here and was closed in favour of the upstream one.Diagnostic for @Demon12377. Could you share your Windows build and ntdll version? Could you also run this patch on
3973179about 20 times, plus a matching count onf85101b? It is an extra 10 lines in the test, keeps the assertion, and prints the stack gap and whether an immediate retry succeeds:If you see
n=0 retry=8, a smallrsp-StackLimitandStackLimitdropping by0x1000when it fails, it's #742. Here, in 8 runs of the real test (5 debug, 3 release),rsp-StackLimitwas 0x120–0x940. In 6 of those runsStackLimitdropped by 0x1000 during that very call, and it still returnedn=8 retry=8. So the test does hit the guard page on Windows 11 26200 too; this build's walk just doesn't give up when it does.I'm not opening a PR because I couldn't get a failing case on this machine.
AI use: Claude Code (Claude Opus 5.5).
@fladit123 on GitHub · 2026-11-25 19:27 UTC · original
Thanks @KainanP for the thorough independent investigation. Your Windows 11 results are consistent with mine, particularly the successful captures during StackLimit changes.
The Windows-version-dependent behavior looks like a strong lead. I agree that the original reporter's Windows build, ntdll version and immediate-retry results would help distinguish this from a revision-specific regression.
Given the existing upstream fix in #653, I will hold off on proposing a separate patch.