drogus added the bug label to Issue #7273.
drogus opened issue #7273:
I'm running a Tokio async Wasmtime example and I was trying to call a WASM function multiple times. When called more than once a
TypedFunc
panics.Steps to Reproduce
In the tokio example one has to change the code to call the function to sth like:
let func = instance .clone() .get_typed_func::<(), ()>(&mut store, "_start")?; for i in 1..10 { println!("{i}"); func.call_async(&mut store, ()).await?; }
Expected Results
If it's possible to call a function multiple times it should not panic and allow it.
If it's not possible to call a function multiple times the
call_async
method should consume the function to not allow to call it again.Actual Results
Error: error while executing at wasm backtrace: 0: 0x2e3 - <unknown>!_start note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information Caused by: wasm trap: wasm `unreachable` instruction executed
Versions and Environment
tokio = { version = "1.20", features = ["full"] } wasmtime = "13" anyhow = "1" wasmtime-wasi = { version = "13", features = ["tokio"] } wasi-common = "13.0.0"
Operating system: Mac OSX
Architecture: Arm64
Extra Info
I'd be happy to provide a fix, but I'm not sure which way is correct: do not allow to call a function multiple times or allow it and thus fix the call.
drogus edited issue #7273:
I'm running a Tokio async Wasmtime example and I was trying to call a WASM function multiple times. When called more than once a
TypedFunc
panics.Steps to Reproduce
In the tokio example one has to change the code to call the function to sth like:
let func = instance .clone() .get_typed_func::<(), ()>(&mut store, "_start")?; for i in 1..10 { println!("{i}"); func.call_async(&mut store, ()).await?; }
Expected Results
If it's possible to call a function multiple times it should not panic and allow it.
If it's not possible to call a function multiple times the
call_async
method should consume the function to not allow to call it again.Actual Results
Error: error while executing at wasm backtrace: 0: 0x2e3 - <unknown>!_start note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information Caused by: wasm trap: wasm `unreachable` instruction executed
Versions and Environment
tokio = { version = "1.20", features = ["full"] } wasmtime = "13" anyhow = "1" wasmtime-wasi = { version = "13", features = ["tokio"] } wasi-common = "13.0.0"
Update: happens also when using
git
for dependenciesOperating system: Mac OSX
Architecture: Arm64
Extra Info
I'd be happy to provide a fix, but I'm not sure which way is correct: do not allow to call a function multiple times or allow it and thus fix the call.
drogus commented on issue #7273:
I was talking with @RReverser and he pointed out that
_start
has a bunch of stuff generated into it when compiling towasm32-wasi
, so I guess it's not strictly a Wasmtime issue. That said, if you think some kind of a check to make the error more friendly sounds good, I'd be happy to provide the implementation.
drogus edited a comment on issue #7273:
I was talking with @RReverser and he pointed out that
_start
has a bunch of stuff generated into it when compiling towasm32-wasi
, so I guess it's not strictly a Wasmtime issue. Ie. I've checked an exported function and it works fine. That said, if you think some kind of a check to make the error more friendly sounds good, I'd be happy to provide the implementation.
RReverser commented on issue #7273:
Yeah I don't think this is Wasmtime issue - the compiled code just has an assertion to make sure it's initialized only once, and isn't supposed to be called multiple times. Same could happen with any other exported function, it's entirely up to specific Wasm.
drogus closed issue #7273:
I'm running a Tokio async Wasmtime example and I was trying to call a WASM function multiple times. When called more than once a
TypedFunc
panics.Steps to Reproduce
In the tokio example one has to change the code to call the function to sth like:
let func = instance .clone() .get_typed_func::<(), ()>(&mut store, "_start")?; for i in 1..10 { println!("{i}"); func.call_async(&mut store, ()).await?; }
Expected Results
If it's possible to call a function multiple times it should not panic and allow it.
If it's not possible to call a function multiple times the
call_async
method should consume the function to not allow to call it again.Actual Results
Error: error while executing at wasm backtrace: 0: 0x2e3 - <unknown>!_start note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information Caused by: wasm trap: wasm `unreachable` instruction executed
Versions and Environment
tokio = { version = "1.20", features = ["full"] } wasmtime = "13" anyhow = "1" wasmtime-wasi = { version = "13", features = ["tokio"] } wasi-common = "13.0.0"
Update: happens also when using
git
for dependenciesOperating system: Mac OSX
Architecture: Arm64
Extra Info
I'd be happy to provide a fix, but I'm not sure which way is correct: do not allow to call a function multiple times or allow it and thus fix the call.
Last updated: Nov 22 2024 at 16:03 UTC