Increase crash handler thread stack guarantee to 128 KiB on Windows - #1500
Merged
Conversation
Build the Windows sentry-native binaries (x64 and ARM64, Crashpad and Native backends) with SENTRY_HANDLER_STACK_SIZE=128, doubling the upstream 64 KiB default. The guarantee is the stack region kept usable for the in-process exception handler when a thread crashes with a stack overflow; extra headroom matters most for the Native backend, whose in-process filter does substantially more work on the crashing thread. The upstream default is calibrated for the 1 MB default Windows thread stack, while Unreal links the game thread with a 12 MB stack, so the larger guarantee costs ~1% of stack headroom and no additional committed memory. The factor-10 eligibility check now requires a 1.28 MB stack reserve, which Unreal threads easily satisfy. The value remains overridable at runtime via the SENTRY_HANDLER_STACK_SIZE env var.
mujacica
approved these changes
Jul 28, 2026
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR sets
SENTRY_HANDLER_STACK_SIZE=128for the Windows sentry-native builds (x64 and ARM64, both Crashpad and Native backends), doubling the thread stack guarantee for the crash handler from the upstream 64 KiB default. This is done to improve the reliability of stack-overflow crash capturing by giving the crash handler more stack headroom to run afterEXCEPTION_STACK_OVERFLOWerror is raised.Why 128 KiB:
/STACK:12000000), so 128 KiB is ~1% of headroom and costs no additional committed memory - the overflow exception simply fires 128 KiB earlier within the reserve.Related Items