Commit 60e44c6
fix(wasm): use ccall({async:true}) — THE fix for ASYNCIFY streaming (#34)
Root cause of all WASM hanging: Module._wasm_generate_async() is a
DIRECT function call that does NOT return a Promise even with ASYNCIFY.
Only Module.ccall('fn', ..., {async: true}) makes Emscripten create
the async wrapper that properly unwinds/rewinds the C stack.
The try/catch was silently falling through to Module._wasm_generate()
(the sync version), blocking the entire main thread.
Fix: replace Module._wasm_generate_async() with Module.ccall() using
{async: true}. Add ccall/cwrap to EXPORTED_RUNTIME_METHODS.
This is the documented Emscripten ASYNCIFY pattern:
https://emscripten.org/docs/porting/asyncify.html#making-async-web-apis-behave-as-if-they-were-synchronous
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 01e0a2d commit 60e44c6
4 files changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
440 | 452 | | |
441 | 453 | | |
442 | 454 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
0 commit comments