Skip to content

Conversation

@jschwe
Copy link
Member

@jschwe jschwe commented Nov 15, 2025

When running Servo with ASAN we hit the stack limit. We can use compile-time parsing of environment variables, to allow the embedder to configure the style thread stack size.

Fixes #223

When running Servo with ASAN we hit the stack limit.
We can use compile-time parsing of environment variables,
to allow the embedder to configure the style thread stack size.
Comment on lines +40 to +51
pub const STYLE_THREAD_STACK_SIZE_KB: usize = const {
let default_stack_size = 512;
if let Some(user_def_size) = option_env!("SERVO_STYLE_THREAD_STACK_SIZE_KB") {
if let Ok(user_def_size) = usize::from_str_radix(user_def_size, 10) {
user_def_size
} else {
panic!("SERVO_STYLE_THREAD_STACK_SIZE_KB must be a valid integer")
}
} else {
default_stack_size
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to make this a bit simpler and just increase the stack size when ASAN is enabled?

Copy link
Member

Choose a reason for hiding this comment

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

Given servo/servo#40814 I would also like to do this for debug builds, if possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer keeping it configurable too, since it allows embedders to adjust the stack size based on their needs.
The code is quite simple, just very verbose since we can't use any traits in const contexts, like and_then() or unwrap_or().

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.

Allow increasing stack size for use with ASAN

3 participants