Skip to content

Rust runtime fails trying to create threads with requested stack size < TLS size #6233

Closed
@kalenedrael

Description

@kalenedrael

Linking with certain external libraries can inflate the required amount of thread local storage to astronomical proportions. When the Rust runtime tries to create its threads, it requests a stack size independent of the TLS size, which can lead to pthread_create() failing with EINVAL when the stack size is smaller than the TLS size. This was apparently an issue for the Go runtime as well (http://sourceware.org/ml/libc-alpha/2012-06/msg00175.html).

A potential workaround is to add __static_tls_size (+ possibly a guard page) to the requested stack size, but it's arguably a bug in glibc that TLS comes out of the requested stack, instead of being added to it. This solution is also admittedly not very pleasing...

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions