-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
wasm-proposal:component-model-asyncIssues related to the WebAssembly Component Model async proposalIssues related to the WebAssembly Component Model async proposal
Description
This test case:
(component
(component $A
(core module $a
(func (export "run") (result i32)
i32.const 1)
;; raise a trap in the callback which is what causes the host-side panic
(func (export "run-cb") (param i32 i32 i32) (result i32)
unreachable)
)
(core instance $a (instantiate $a))
(func (export "run")
(canon lift (core func $a "run") async (callback (func $a "run-cb"))))
)
(component $B
(import "a" (instance $a (export "run" (func))))
(core module $libc (memory (export "memory") 1))
(core instance $libc (instantiate $libc))
(core func $run (canon lower (func $a "run") async))
(core func $new (canon waitable-set.new))
(core func $join (canon waitable.join))
(core func $drop (canon waitable-set.drop))
(core func $wait (canon waitable-set.wait (memory $libc "memory")))
(core module $b
(import "" "run" (func $run_a (result i32)))
(import "" "new" (func $new (result i32)))
(import "" "join" (func $join (param i32 i32)))
(import "" "drop" (func $drop (param i32)))
(import "" "wait" (func $wait (param i32 i32) (result i32)))
(func (export "run")
(local $ret i32)
(local $set i32)
(local.set $ret (call $run_a))
;; make sure it's in the "started" state
(if (i32.ne (i32.and (local.get $ret) (i32.const 0xf)) (i32.const 1))
(then (unreachable)))
;; extract the waitable handle
(local.set $ret (i32.shr_u (local.get $ret) (i32.const 4)))
;; Make a waitable set and insert our handle into it
(local.set $set (call $new))
(call $join (local.get $ret) (local.get $set))
;; wait for something to happen filling in memory address 4, but don't
;; actually see what happened since this panics right now.
(call $wait (local.get $set) (i32.const 4))
drop
)
)
(core instance $b (instantiate $b
(with "" (instance
(export "run" (func $run))
(export "new" (func $new))
(export "join" (func $join))
(export "drop" (func $drop))
(export "wait" (func $wait))
))
))
(func (export "run")
(canon lift (core func $b "run")))
)
(instance $a (instantiate $A))
(instance $b (instantiate $B (with "a" (instance $a))))
(export "run" (func $b "run"))
)
(assert_return (invoke "run"))yields:
$ WASMTIME_BACKTRACE_DETAILS=1 ../wasmtime/target/x86_64-unknown-linux-gnu/release/wasmtime wast -W component-model-async foo.wast
thread 'main' panicked at crates/wasmtime/src/runtime/fiber.rs:442:9:
attempted to drop in-progress fiber without first calling `StoreFiber::dispose`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
wasm-proposal:component-model-asyncIssues related to the WebAssembly Component Model async proposalIssues related to the WebAssembly Component Model async proposal
Type
Projects
Status
Done