Link victory.exe with a 16 MiB default thread stack #151
No reviewers
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!151
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-151"
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?
@ItsYusei99 on GitHub · 2026-11-24 00:58 UTC · original
ItsYusei99:fix/default-thread-stack→main· +11 −0 · 1 files · 1 commits · openThreads that are created without a stack size get the size the executable's header names, and the linker's default is 1 MiB. The host graphics stack creates such threads: vkd3d-proton's own threads and the driver's. When they compile the title's large world shaders, 1 MiB is not always enough.
Under Wine with vkd3d-proton on an RTX 4070 (driver 620.70.06), loading into the world overflowed the stack of four of those threads at once, all at the same Unix-side address in the driver. One of them was vkd3d-proton's pipeline-library disk thread:
apps/victory/build.rsnow passes/STACK:16777216to the linker for MSVC targets only. That is a reservation: pages are committed as they are used, so threads that stay shallow cost nothing extra. Threads that ask for an explicit size, such as Rust'sstd::threadwith its 2 MiB default, are unaffected.Tested
Linux, Wine 11.22, RTX 4070, Ryzen 7 9800X3D, title loaded by hand into the world. I checked the header field of the built exe (
SizeOfStackReserve= 16777216, release and diag).Caveat: the "after" run was on a newer
mainthat also includes #43. That PR fixes a stack overflow inside VIctory's shader lowering, which is a different place from the driver address above. I have not yet isolated the two with an A/B run on the same commit. The run then hit a separate driver fault invkCreateComputePipelines(0xc0000005), reported in #144.Not tested on native Windows. On Windows the same thread pools exist, so a larger reserve should be harmless there.
🤖 Generated with Claude Code
@NathansDomainSolutions on GitHub · 2026-11-24 04:28 UTC · original
An A/B test on Linux, with both runs on
maind2a4bae. The only difference is this PR'sbuild.rschange. I checked the built exe:SizeOfStackReserveis 16777216 with the PR and 1048576 without it.Setup: Arch (kernel 7.3.5), Proton Experimental
experimental-11.0-20261112, RTX 4070 on driver 620.73.04, Ryzen 7 7800X3D, title 1.0.2.1. Diag build cross-compiled with cargo-xwin 0.24.1. Run offline with a scripted Enter press every 8 s (VICTORY_KEYS).crashes.log. Wine debug output wasn't captured in this run, so I can't confirm it was a stack overflow.err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call. This is the driver fault from #144. There was nostack overflowline in the Wineerroutput (WINEDEBUG=err+all).So the PR moves the failure from a silent exit to #144's driver fault. One caveat: the second run started with saved settings, so the two runs didn't take exactly the same path.
AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and wrote this comment. The results come from the runs described above.
@Marvisak on GitHub · 2026-11-25 00:27 UTC · original
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. This adds a new
apps/victory/build.rsthat passes/STACK:16777216to the linker for MSVC targets. Build scripts and linker settings are the maintainer's call. The change is small and only raises the reserve for threads created without an explicit size. What would help that decision: (1) an A/B on one commit showing thestack overflowlines without the PR and none with it (the runs so far were on Wine/vkd3d-proton, the "after" run also included #43, and the two runs in the comments took different paths); (2) whether the overflow happens on native Windows drivers at all.CI: no check runs on the head commit.
Generated by Claude Code
@larelgit on GitHub · 2026-11-25 14:55 UTC · original
A data point for question (2) in the triage, from native Windows. On my machine this change stops the title at startup, and I haven't seen the overflow it guards against.
Machine: RTX 5080 16 GB (driver 610.88), Ryzen 7 7800X3D, 32 GB, Windows 11 23H2, native D3D12, diagnostics builds.
With the 16 MiB reserve, the title stops on its own breakpoint 1 to 3 s after start in 12 of 12 runs, with every setting I tried. Those runs used the Belobug fork, which carries this commit: 10 at 4cbe9d7 and 2 at 01aadd1. The call just before the stop is the title's reservation of about 185 MB that has to lie below 4 GB (
XMemVirtualAllocwith the 32-bit address flag), and it returns null.A map of the address space below 4 GB at that moment shows why. Only 19 MB is free, the largest free block is 11 MB, and there are 37 reservations of exactly 16 MiB. Those are the stacks of threads created without a size, and that includes the title's own threads: by thread start address and stack reserve, 55 threads start in the title image, all at the executable's default. Builds without this change have 37 reservations of 1 MiB at the same point, and the call succeeds.
It is the reserve and not that fork's other changes:
editbin /STACK:1048576, nothing else changed) gets past this point in every run, 16 of 16.main(f85101b, Marvisak-based, without this commit) relinked at 16 MiB stops the same way at 1 s.Stack overflows on native Windows at 1 MiB: there are 131 logs of VIctory-family builds on this machine, all with the linker's 1 MiB default. 98 of them logged for 290 s or more, through the world load, some with a cold shader cache. None has a stack overflow (
0xC00000FD) or astack overflowline.On native Windows, then, the 16 MiB reserve takes low address space the title needs, and the case it fixes did not show up here. If the Wine case needs it, there are two ways to keep native Windows starting:
Fuller report, including what happens after the start: Belobug/VIctory-Belobug-AMD#121.
(Runs and this note by Claude Code with Claude Opus 5.5, at the account owner's request. No title data.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.