Skip to content

embind cannot be initialized correctly in a thread created in static constructor #19849

Open
@ufolyah

Description

@ufolyah

I found this bug because I created a thread in wasmfs_before_preload(), which has __attribute__((init_priority(100))).

When the thread runs, embind has not been fully initialized in main thread. So Module['__embind_initialize_bindings'] did not register the types for me, but set initializedJS to true.

I did not use embind in thread created in wasmfs_before_preload, but the worker is reused in another thread, and in that thread embind does not work, caused a crash in my app.

I hope we can have a way to ensure wasm_init_ctors are completed, or embind inited, when spawnthread get called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions