Skip to content

Exception thrown by WebAssembly in async function causes Deno to hang forever #23385

Open
@kylebarron

Description

Version: Deno 1.41.3

Reproduction: https://github.com/kylebarron/wasm-bindgen-deno-test

This exports a simple function panic_async. If you call this with await wasm.panic_async();,
the future never resolves and the REPL hangs forever:

image

Note that if you call the function without await then you do get an Uncaught RuntimeError

> wasm.panic_async();
Promise { <pending> }
Uncaught RuntimeError: unreachable
    at <anonymous> (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test_bg.wasm:1:10804)
    at <anonymous> (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test_bg.wasm:1:16086)
    at <anonymous> (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test_bg.wasm:1:12546)
    at <anonymous> (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test_bg.wasm:1:8885)
    at <anonymous> (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test_bg.wasm:1:16497)
    at __wbg_adapter_16 (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test.js:81:10)
    at real (file:///Users/kyle/tmp/wasm-bindgen-deno-test/wasm-bindgen-deno-test/pkg/wasm_bindgen_deno_test.js:66:20)
    at ext:core/01_core.js:303:9
    at eventLoopTick (ext:core/01_core.js:169:7)

So I assume what's happening here is that constructing the future errors and then there's nothing to await, or something like that.

For contrast, running this in Node crashes the process:

image

To reproduce:

wasm-pack build --target web

Then inside Deno:

const wasm = await import("./pkg/wasm_bindgen_deno_test.js");
let _ = await wasm.default();
await wasm.panic_async();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlydeno_coreChanges in "deno_core" crate are needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions