alexcrichton opened issue #14576:
The current handling of
do_not_suspendrelies on stack-like behavior of sync tasks (LIFO) but recent spec changes means that this is no longer a guarantee. For example this test I believe should pass:#[tokio::test] #[cfg_attr(miri, ignore)] async fn concurrent_sync_typed_calls_with_yield() -> Result<()> { let engine = Engine::default(); let component = Component::new( &engine, r#" (component (core func $thread.yield (canon thread.yield)) (core func $task.return (canon task.return)) (core module $m (import "" "thread.yield" (func $yield (result i32))) (import "" "task.return" (func $task.return)) (global $s1-running (mut i32) (i32.const 0)) (func (export "s1") (global.set $s1-running (i32.const 1)) (drop (call $yield)) (global.set $s1-running (i32.const 0))) (func (export "s2") (if (global.get $s1-running) (then unreachable)) (drop (call $yield))) (func (export "noop") (result i32) (call $task.return) (i32.const 0)) ;; EXIT (func (export "cb") (param i32 i32 i32) (result i32) unreachable)) (core instance $i (instantiate $m (with "" (instance (export "thread.yield" (func $thread.yield)) (export "task.return" (func $task.return)))))) (func (export "s1") (canon lift (core func $i "s1"))) (func (export "s2") (canon lift (core func $i "s2"))) (func (export "noop") async (canon lift (core func $i "noop") async (callback (core func $i "cb")))) ) "#, )?; let mut store = Store::new(&engine, ()); let instance = Linker::new(&engine) .instantiate_async(&mut store, &component) .await?; let s1 = instance.get_typed_func::<(), ()>(&mut store, "s1")?; let s2 = instance.get_typed_func::<(), ()>(&mut store, "s2")?; let noop = instance.get_typed_func::<(), ()>(&mut store, "noop")?; store .run_concurrent(async |accessor| { futures::future::try_join( s1.call_concurrent(accessor, ()), s2.call_concurrent(accessor, ()), ) .await }) .await??; store .run_concurrent(async |accessor| noop.call_concurrent(accessor, ()).await .await??; Ok(()) }but it currently traps.
More wast tests, and an LLM summary if useful, can be found at https://gist.github.com/alexcrichton/6ff5e1688251f5988efca3fc9a83c705
alexcrichton added the wasm-proposal:component-model-async label to Issue #14576.
alexcrichton commented on issue #14576:
A related issue is that right now the runtime will only run sibling threads for a blocked sync task on the first switch, but after that it'll run anything. This is I believe all safe and sound and fine, but spec-incorrect. Some LLM details/summary is at https://gist.github.com/alexcrichton/26e1f262bfda51ab286765985184001d
fitzgen added the bug label to Issue #14576.
Last updated: Oct 11 2026 at 04:10 UTC