Skip to content

Increase stack size in examples/threads.c#7651

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:increase-stack-size
Dec 6, 2023
Merged

Increase stack size in examples/threads.c#7651
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:increase-stack-size

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit is an attempt to address the CI failure popping up in #7636. I can reproduce the failure locally and it appears to be due to the fact that macOS is giving spawned threads via pthread_create a 512K stack by default. Cranelift when compiled in debug mode is taking more stack than this (but working in release mode). I was talking with Trevor and Jamey about possible ways to reduce the stack size here but for now I'm going with Jamey's suggestion of increasing the stack size as the best course of action for now.

This commit is an attempt to address the CI failure popping up in bytecodealliance#7636.
I can reproduce the failure locally and it appears to be due to the fact
that macOS is giving spawned threads via `pthread_create` a 512K stack
by default. Cranelift when compiled in debug mode is taking more stack
than this (but working in release mode). I was talking with Trevor and
Jamey about possible ways to reduce the stack size here but for now I'm
going with Jamey's suggestion of increasing the stack size as the best
course of action for now.
@alexcrichton alexcrichton requested a review from elliottt December 6, 2023 22:03
@alexcrichton alexcrichton requested a review from a team as a code owner December 6, 2023 22:03
@alexcrichton alexcrichton requested review from pchickey and removed request for a team December 6, 2023 22:03
Copy link
Copy Markdown
Member

@elliottt elliottt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! It's also nice that we'll use 2MB across all platforms for this test now, instead of allowing for varying defaults.

@alexcrichton alexcrichton added this pull request to the merge queue Dec 6, 2023
Merged via the queue into bytecodealliance:main with commit 21c065e Dec 6, 2023
@alexcrichton alexcrichton deleted the increase-stack-size branch December 6, 2023 22:55
maxbrunsfeld added a commit to zed-industries/zed that referenced this pull request Feb 26, 2024
After upgrading to Wasmtime 18, we got crashes when running Zed in debug mode.
While bisecting the Wasmtime commits and trying to identify the source of the
crash, we noticed this Wasmtime PR, which increased the stack size of background
threads in an example. This alerted us to the possibility that a stack overflow
might be happening due to a lot of stack usage by cranelift.

bytecodealliance/wasmtime#7651

Co-authored-by: Marshall <marshall@zed.dev>
maxbrunsfeld added a commit to zed-industries/zed that referenced this pull request Feb 27, 2024
…s in debug builds (#8452)

After upgrading to Wasmtime 18, we got crashes when running Zed in debug
mode. While bisecting the Wasmtime commits and trying to identify the
source of the crash, we noticed this Wasmtime PR, which increased the
stack size of background threads in an example. This alerted us to the
possibility that a stack overflow might be happening due to a lot of
stack usage by cranelift.

bytecodealliance/wasmtime#7651

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants