-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixing
Description
Test Case
use wasmtime::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut tasks = tokio::task::JoinSet::<wasmtime::Result<()>>::new();
let engine = Engine::new(Config::new().async_support(true))?;
let wasm_bytes = &wat::parse_str(
r#"
(module
(func $hello (import "host" "hello"))
(func (export "run") (call $hello))
)
"#,
)?;
for i in 0..2 {
let mut store = Store::new(&engine, ());
let module = Module::new(&engine, wasm_bytes)?;
let hello_func = Func::wrap_async(&mut store, move |_caller: Caller<'_, ()>, _args: ()| {
Box::new(async move {
println!("Instance {i}: Hello from async WASM!");
tokio::time::sleep(tokio::time::Duration::from_millis(10)).await;
println!("Instance {i}: After 1 ms sleep");
Ok(())
})
});
let instance = Instance::new_async(&mut store, &module, &[hello_func.into()]).await?;
let run = instance.get_typed_func::<(), ()>(&mut store, "run")?;
tasks.spawn(async move {
for _i in 0..5 {
run.call_async(&mut store, ()).await?;
}
Ok(())
});
}
while let Some(result) = tasks.join_next().await {
result??;
}
Ok(())
}
Steps to Reproduce
cargo build --target aarch64-linux-android
# run on android device
Expected Results
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Instance 0: After 1 ms sleep
Instance 0: Hello from async WASM!
Instance 1: After 1 ms sleep
...
Actual Results
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Illegal instruction
with lldb
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Process 14726 stopped
* thread #2, name = 'tokio-runtime-w', stop reason = signal SIGILL: illegal operand
frame #0: 0x00000055567db894 fiber-test`wasmtime_fiber_switch_34_0_2 + 100
fiber-test`wasmtime_fiber_switch_34_0_2:
-> 0x55567db894 <+100>: autiasp
0x55567db898 <+104>: ret
fiber-test`_$LT$core..result..Result$LT$T$C$F$GT$$u20$as$u20$core..ops..try_trait..FromResidual$LT$core..result..Result$LT$core..convert..Infallible$C$E$GT$$GT$$GT$::from_residual::h0eebfda855441d32:
0x55567db89c <+0>: sub sp, sp, #0x20
0x55567db8a0 <+4>: mov x9, x8
Versions and Environment
Wasmtime version or commit: 34.0.2
Operating system: Android 14
Architecture: aarch64
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixing