Skip to content

Stack overflow check broken when used with pthreads and embind in 2.0.3 onwards #12356

Closed
@cwoffenden

Description

@cwoffenden

In 2.0.3 onwards when combining pthreads, --bind and -s STACK_OVERFLOW_CHECK=2 the stack check is failing for the workers (but is fine on the main thread). It's reproducible with one of the simpler pthread test files, for example:

emcc -s USE_PTHREADS=1 --bind -s STACK_OVERFLOW_CHECK=2 tests/pthread/test_pthread_create.cpp

Because the order of creation means embind is initialised before the stack checker, a false stack overflow is always generated from __embind_register_native_and_builtin_types() (since the limits are not yet inited).

This broke with changes in either #12095 or #12104 (more details to be added tomorrow if needed; we ran out of time today).

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