emscripten-core / emscripten-core/emscripten

EM_ASYNC_JS + emscripten_exit_with_live_runtime() = Uncaught (in promise) unwind

Open
#18,442 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Maybe related to #12814.

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.28 (f11d6196dd4e8748a726f19895c859b40ff6a4f3)
clang version 16.0.0 (https://github.com/llvm/llvm-project ea4be70cea8509520db8638bb17bcd7b5d8d60ac)
Target: wasm32-unknown-emscripten
Thread model: posix

**Code:** test.c
```.c
#include

EM_ASYNC_JS(int, testme, (void), {
await 5;
return 0;
});

int
main(void)
{
testme();
emscripten_exit_with_live_runtime();
return 0;
}
```
**Command:** `emcc -o test.html test.c -sASYNCIFY`
**Browser:** Chromium 107.0.5304.87
**Error:**
```
Uncaught (in promise) unwind
Promise.then (async)
(anonymous) @ test.js:1643
handleSleep @ test.js:1561
handleAsync @ test.js:1641
__asyncjs__testme @ test.js:1235
imports. @ test.js:1437
$func4 @ test.wasm:0x3b1
$main @ test.wasm:0x473
ret. @ test.js:1471
(anonymous) @ test.js:1043
callMain @ test.js:2156
doRun @ test.js:2210
(anonymous) @ test.js:2221
setTimeout (async)
run @ test.js:2217
runCaller @ test.js:2141
removeRunDependency @ test.js:942
receiveInstance @ test.js:1133
receiveInstantiationResult @ test.js:1151
Promise.then (async)
(anonymous) @ test.js:1192
Promise.then (async)
instantiateAsync @ test.js:1184
createWasm @ test.js:1222
(anonymous) @ test.js:1657
```

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.