Stream: general

Topic: Rust Guest unreachable debugging


view this post on Zulip Daniel Macovei (Nov 28 2022 at 04:30):

Any tips on debugging this? It's in a rust guest exported function. The export works fine until I try to call a function from a third party crate in it, but calling the function creates the error

RuntimeError: unreachable
    at __wasi_proc_exit (<anonymous>:wasm-function[482]:0x1c73a)
    at _Exit (<anonymous>:wasm-function[483]:0x1c740)
    at __wasilibc_populate_preopens (<anonymous>:wasm-function[491]:0x1cc42)
    at __wasm_call_ctors (<anonymous>:wasm-function[17]:0xbfa)

view this post on Zulip Daniel Macovei (Nov 28 2022 at 04:31):

if i were just compiling, I guess I could add a flag for better errors, but not quite sure how to do that executing the wasm module from a js host

view this post on Zulip bjorn3 (Nov 28 2022 at 12:11):

The only cases __wasilibc_populate_preopens calls _Exit seem to be when fd_prestat_get or fd_prestat_dir_name return an error.

view this post on Zulip bjorn3 (Nov 28 2022 at 12:12):

Are you treating the wasm module as a library and calling a function other than the start function? If so you will need to compile as a wasi reactor rather than wasi command like is the default.

view this post on Zulip bjorn3 (Nov 28 2022 at 12:13):

A wasi command has it's start function called once and after that can't be called into again. A wasi reactor has an initialize function called once and after that you can call any exported function you want.

view this post on Zulip bjorn3 (Nov 28 2022 at 12:14):

@Daniel Macovei


Last updated: Dec 23 2024 at 13:07 UTC