Skip to content

musl default pthread stack stack does not match DEFAULT_PTHREAD_STACK_SIZE #15101

@sbc100

Description

@sbc100

We have a build setting called DEFAULT_PTHREAD_STACK_SIZE (default to 2Mb) which kicks in when a thread is created without any attributes.

However if one create a default set of attributes using pthread_attr_init musl will configure it with its own internal default which is 80k:

#define DEFAULT_STACK_SIZE 81920

Possible solutions:

  1. Have musl call back out the JS to know the actual default desired by the user (not know at libc compile time)
  2. Remove DEFAULT_PTHREAD_STACK_SIZE and users who want a custom stack size can do so programmatically using pthread_attr_setstacksize
  3. Set musl's DEFAULT_STACK_SIZE to match the default DEFAULT_PTHREAD_STACK_SIZE so most users will never notice (only users who override DEFAULT_PTHREAD_STACK_SIZE would see this behaviour).

(3) is the safest thing to do right away which will fix at least one know issue I found in the lsan codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions