alexcrichton opened issue #14950:
This program:
use wasmtime::component::{Component, Linker}; use wasmtime::{Engine, Store}; fn main() { let engine = Engine::default(); let component = Component::new( &engine, r#" (component (component $inner (core module $m (func (export "f") (param i32) (result i32) (i32.add (local.get 0) (i32.const 3)))) (core instance $i (instantiate $m)) (func (export "f") async (param "x" u32) (result u32) (canon lift (core func $i "f")))) (instance $inner (instantiate $inner)) (core func $f (canon lower (func $inner "f"))) (core module $m (import "" "f" (func $f (param i32) (result i32))) (func (export "run") (param i32) (result i32) (call $f (local.get 0)))) (core instance $i (instantiate $m (with "" (instance (export "f" (func $f)))))) (func (export "run") (param "x" u32) (result u32) (canon lift (core func $i "run"))) ) "#, ) .unwrap(); let mut store = Store::new(&engine, ()); let instance = Linker::new(&engine).instantiate(&mut store, &component).unwrap(); let run = instance .get_typed_func::<(u32,), (u32,)>(&mut store, "run") .unwrap(); println!("{:?}", run.call(&mut store, (4,))); }currently yields:
$ cargo run thread 'main' panicked at .../wasmtime-50.0.0/src/runtime/bug.rs:63:13: BUG: Instance::start_call called without a running event loopIf
call_asyncis used, however, this works fine. This is something where the spec has changed over time where originally we could rely on normal component model traps to ensure thatFunc::callpretty much worked as expected, but with recent spec changes it effectively requires the event loop to be running and to activate fibers and such.In essence a synchronous entrypoint for component model functions is no longer really compatible with the component model spec definition. I don't know exactly how to thread this needle myself, but we may want to consider deprecating
Func::call.
alexcrichton added the wasm-proposal:component-model-async label to Issue #14950.
alexcrichton edited issue #14950:
This program:
CM#123
use wasmtime::component::{Component, Linker}; use wasmtime::{Engine, Store}; fn main() { let engine = Engine::default(); let component = Component::new( &engine, r#" (component (component $inner (core module $m (func (export "f") (param i32) (result i32) (i32.add (local.get 0) (i32.const 3)))) (core instance $i (instantiate $m)) (func (export "f") async (param "x" u32) (result u32) (canon lift (core func $i "f")))) (instance $inner (instantiate $inner)) (core func $f (canon lower (func $inner "f"))) (core module $m (import "" "f" (func $f (param i32) (result i32))) (func (export "run") (param i32) (result i32) (call $f (local.get 0)))) (core instance $i (instantiate $m (with "" (instance (export "f" (func $f)))))) (func (export "run") (param "x" u32) (result u32) (canon lift (core func $i "run"))) ) "#, ) .unwrap(); let mut store = Store::new(&engine, ()); let instance = Linker::new(&engine).instantiate(&mut store, &component).unwrap(); let run = instance .get_typed_func::<(u32,), (u32,)>(&mut store, "run") .unwrap(); println!("{:?}", run.call(&mut store, (4,))); }currently yields:
$ cargo run thread 'main' panicked at .../wasmtime-50.0.0/src/runtime/bug.rs:63:13: BUG: Instance::start_call called without a running event loopIf
call_asyncis used, however, this works fine. This is something where the spec has changed over time where originally we could rely on normal component model traps to ensure thatFunc::callpretty much worked as expected, but with recent spec changes it effectively requires the event loop to be running and to activate fibers and such.In essence a synchronous entrypoint for component model functions is no longer really compatible with the component model spec definition. I don't know exactly how to thread this needle myself, but we may want to consider deprecating
Func::call.
alexcrichton edited issue #14950:
This program:
wasm-tools#123
use wasmtime::component::{Component, Linker}; use wasmtime::{Engine, Store}; fn main() { let engine = Engine::default(); let component = Component::new( &engine, r#" (component (component $inner (core module $m (func (export "f") (param i32) (result i32) (i32.add (local.get 0) (i32.const 3)))) (core instance $i (instantiate $m)) (func (export "f") async (param "x" u32) (result u32) (canon lift (core func $i "f")))) (instance $inner (instantiate $inner)) (core func $f (canon lower (func $inner "f"))) (core module $m (import "" "f" (func $f (param i32) (result i32))) (func (export "run") (param i32) (result i32) (call $f (local.get 0)))) (core instance $i (instantiate $m (with "" (instance (export "f" (func $f)))))) (func (export "run") (param "x" u32) (result u32) (canon lift (core func $i "run"))) ) "#, ) .unwrap(); let mut store = Store::new(&engine, ()); let instance = Linker::new(&engine).instantiate(&mut store, &component).unwrap(); let run = instance .get_typed_func::<(u32,), (u32,)>(&mut store, "run") .unwrap(); println!("{:?}", run.call(&mut store, (4,))); }currently yields:
$ cargo run thread 'main' panicked at .../wasmtime-50.0.0/src/runtime/bug.rs:63:13: BUG: Instance::start_call called without a running event loopIf
call_asyncis used, however, this works fine. This is something where the spec has changed over time where originally we could rely on normal component model traps to ensure thatFunc::callpretty much worked as expected, but with recent spec changes it effectively requires the event loop to be running and to activate fibers and such.In essence a synchronous entrypoint for component model functions is no longer really compatible with the component model spec definition. I don't know exactly how to thread this needle myself, but we may want to consider deprecating
Func::call.
alexcrichton edited issue #14950:
This program:
use wasmtime::component::{Component, Linker}; use wasmtime::{Engine, Store}; fn main() { let engine = Engine::default(); let component = Component::new( &engine, r#" (component (component $inner (core module $m (func (export "f") (param i32) (result i32) (i32.add (local.get 0) (i32.const 3)))) (core instance $i (instantiate $m)) (func (export "f") async (param "x" u32) (result u32) (canon lift (core func $i "f")))) (instance $inner (instantiate $inner)) (core func $f (canon lower (func $inner "f"))) (core module $m (import "" "f" (func $f (param i32) (result i32))) (func (export "run") (param i32) (result i32) (call $f (local.get 0)))) (core instance $i (instantiate $m (with "" (instance (export "f" (func $f)))))) (func (export "run") (param "x" u32) (result u32) (canon lift (core func $i "run"))) ) "#, ) .unwrap(); let mut store = Store::new(&engine, ()); let instance = Linker::new(&engine).instantiate(&mut store, &component).unwrap(); let run = instance .get_typed_func::<(u32,), (u32,)>(&mut store, "run") .unwrap(); println!("{:?}", run.call(&mut store, (4,))); }currently yields:
$ cargo run thread 'main' panicked at .../wasmtime-50.0.0/src/runtime/bug.rs:63:13: BUG: Instance::start_call called without a running event loopIf
call_asyncis used, however, this works fine. This is something where the spec has changed over time where originally we could rely on normal component model traps to ensure thatFunc::callpretty much worked as expected, but with recent spec changes it effectively requires the event loop to be running and to activate fibers and such.In essence a synchronous entrypoint for component model functions is no longer really compatible with the component model spec definition. I don't know exactly how to thread this needle myself, but we may want to consider deprecating
Func::call.
Last updated: Oct 31 2026 at 23:03 UTC