Skip to content

Calling wasi:cli/run#run function twice in the same component instance returns "unreachable instruction executed" error #10219

Closed
@justingaffney

Description

@justingaffney

Test Case

Clone example repo here: https://github.com/justingaffney/wasmtime-run-twice-error

Steps to Reproduce

  • Build component
    • cd guest
    • cargo component build --release
  • Run host
    • cd ../host
    • cargo run

Expected Results

Calling run function for the first time
Hello, world!
Calling run function for the second time
Hello, world!

Actual Results

Calling run function for the first time
Hello, world!
Calling run function for the second time
thread 'main' panicked at host\src\main.rs:41:35:
called `Result::unwrap()` on an `Err` value: error while executing at wasm backtrace:
    0:  0xab2 - <unknown>!<wasm function 5>
    1: 0xbca0 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/[email protected]#run

Caused by:
    wasm trap: wasm `unreachable` instruction executed

Versions and Environment

Wasmtime version or commit: 29.0.1

Operating system: Windows 11

Architecture: x86_64

Extra Info

Not sure if calling the wasi:cli/[email protected]#run function multiple times on the same component instance is supposed to work or not, but it is not clear from the error whether this behaviour is expected or not

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions