Skip to content

Commit

Permalink
win: move stack_overflow_warning to the backtrace fiber (#55640)
Browse files Browse the repository at this point in the history
There is not enough stack space remaining after a stack overflow on
Windows to allocate the 4k page used by `write` to call the WriteFile
syscall. This causes it to hard-crash. But we can simply run this on the
altstack implementation, where there is plenty of space.

(cherry picked from commit eebc1e4)
  • Loading branch information
vtjnash authored and KristofferC committed Sep 9, 2024
1 parent 561e5c8 commit dde7c10
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/signals-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ static jl_ptls_t stkerror_ptls;
static int have_backtrace_fiber;
static void JL_NORETURN start_backtrace_fiber(void)
{
// print the warning (this mysteriously needs a lot of stack for the WriteFile syscall)
stack_overflow_warning();
// collect the backtrace
stkerror_ptls->bt_size =
rec_backtrace_ctx(stkerror_ptls->bt_data, JL_MAX_BT_SIZE, stkerror_ctx,
Expand Down

0 comments on commit dde7c10

Please sign in to comment.