emscripten-core / emscripten-core/emscripten

Module.instantiateWasm callback failed with error: ReferenceError: resetPrototype is not defined, when using pthreads+MODULARIZE+sanitizers

Open
#12,865 4 comments 1 reaction 0 assignees View on GitHub
help wanted wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

When simple C++ source code is compiled with sanitize and pthreads flags, following error occurs at runtime.

Module.instantiateWasm callback failed with error: ReferenceError: resetPrototype is not defined
![emcc_pthread_and_sanitize_error](https://user-images.githubusercontent.com/18116300/99937010-972d5780-2d8a-11eb-919a-8a7bbb2a9c8e.png)

PFA test case [WebAssembly.zip](https://github.com/emscripten-core/emscripten/files/5581442/WebAssembly.zip) to reproduce the above issue.
Issue is reproducible on Emscripten version 2.0.7.
To compile the `test.cc`, following command is used.
`em++ -fsanitize=address -sINITIAL_MEMORY=536870912 -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=1 -sMODULARIZE=1 -sEXPORT_NAME="testWasmModuleReady" --bind --no-entry test.cc -o test.js`

Note that, issue is not reproducible if `sanitize` flag is removed from the compilation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.