Skip to content

std: thread: Return error if setting thread stack size fails - #144210

Merged
bors merged 1 commit into
rust-lang:masterfrom
Gelbpunkt:thread-stack-size-musl
Aug 15, 2025
Merged

std: thread: Return error if setting thread stack size fails#144210
bors merged 1 commit into
rust-lang:masterfrom
Gelbpunkt:thread-stack-size-musl

Conversation

@Gelbpunkt

Copy link
Copy Markdown
Contributor

Currently, when setting the thread stack size fails, it would be rounded up to the nearest multiple of the page size and the code asserts that the next call to pthread_attr_setstacksize succeeds.

This may be true for glibc, but it isn't true for musl, which not only enforces a minimum stack size, but also a maximum stack size of usize::MAX / 4 - PTHREAD_STACK_MIN 1, triggering the assert rather than erroring gracefully.

There isn't any way to handle this properly other than bailing out and letting the user know it didn't succeed.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants