seunghyun-24 opened issue #15300:
Test Case
;;! component_model_async = true ;; Case 1: stream.cancel-write on a readable end with a pending read. (component (type $t (stream u8)) (core module $libc (memory (export "mem") 1)) (core instance $libc (instantiate $libc)) (core func $new (canon stream.new $t)) (core func $read (canon stream.read $t async (memory (core memory $libc "mem")))) (core func $cancel (canon stream.cancel-write $t)) (core module $m (import "" "new" (func $new (result i64))) (import "" "read" (func $read (param i32 i32 i32) (result i32))) (import "" "cancel" (func $cancel (param i32) (result i32))) (func (export "f") (result i32) (local $new i64) (local $end i32) (local.set $new (call $new)) (local.set $end (i32.wrap_i64 (local.get $new))) ;; Start a read on the readable end. It blocks because nothing is written. (if (i32.ne (call $read (local.get $end) (i32.const 0) (i32.const 1)) (i32.const -1)) (then unreachable)) ;; Try to cancel a write on the readable end. (call $cancel (local.get $end)))) (core instance $i (instantiate $m (with "" (instance (export "new" (func $new)) (export "read" (func $read)) (export "cancel" (func $cancel)))))) (func (export "f") async (result u32) (canon lift (core func $i "f")))) (assert_trap (invoke "f") "passed read end to `{stream|future}.cancel-write`")The other three combinations are also affected:
stream.cancel-readon a writable end with a pending writefuture.cancel-writeon a readable end with a pending readfuture.cancel-readon a writable end with a pending writeThe complete test cases are attached in
cancel_wrong_end_busy.wast.Steps to Reproduce
wasmtime wast -W component-model-async=y cancel_wrong_end_busy.wastExpected Results
The call should trap because the handle refers to a readable end, but
cancel-writewas called.Actual Results
The call returns
CANCELLED(2) instead of trapping.Versions and Environment
- Wasmtime version or commit: main at c52bc6d8f (52.0.0-dev)
- Operating system: macOS 26.6
- Architecture: aarch64
Extra Info
In a release build the two
bail_bug!s surface as traps. In a build with debug assertions they panic (bug.rs:63), asWasmtimeBug::newis written to do.
seunghyun-24 added the bug label to Issue #15300.
seunghyun-24 edited issue #15300:
cancel_wrong_end_busy.wast.txt
cancel_wrong_end_followon.wast.txtTest Case
;;! component_model_async = true ;; Case 1: stream.cancel-write on a readable end with a pending read. (component (type $t (stream u8)) (core module $libc (memory (export "mem") 1)) (core instance $libc (instantiate $libc)) (core func $new (canon stream.new $t)) (core func $read (canon stream.read $t async (memory (core memory $libc "mem")))) (core func $cancel (canon stream.cancel-write $t)) (core module $m (import "" "new" (func $new (result i64))) (import "" "read" (func $read (param i32 i32 i32) (result i32))) (import "" "cancel" (func $cancel (param i32) (result i32))) (func (export "f") (result i32) (local $new i64) (local $end i32) (local.set $new (call $new)) (local.set $end (i32.wrap_i64 (local.get $new))) ;; Start a read on the readable end. It blocks because nothing is written. (if (i32.ne (call $read (local.get $end) (i32.const 0) (i32.const 1)) (i32.const -1)) (then unreachable)) ;; Try to cancel a write on the readable end. (call $cancel (local.get $end)))) (core instance $i (instantiate $m (with "" (instance (export "new" (func $new)) (export "read" (func $read)) (export "cancel" (func $cancel)))))) (func (export "f") async (result u32) (canon lift (core func $i "f")))) (assert_trap (invoke "f") "passed read end to `{stream|future}.cancel-write`")The other three combinations are also affected:
stream.cancel-readon a writable end with a pending writefuture.cancel-writeon a readable end with a pending readfuture.cancel-readon a writable end with a pending writeThe complete test cases are attached in
cancel_wrong_end_busy.wast.Steps to Reproduce
wasmtime wast -W component-model-async=y cancel_wrong_end_busy.wastExpected Results
The call should trap because the handle refers to a readable end, but
cancel-writewas called.Actual Results
The call returns
CANCELLED(2) instead of trapping.Versions and Environment
- Wasmtime version or commit: main at c52bc6d8f (52.0.0-dev)
- Operating system: macOS 26.6
- Architecture: aarch64
Extra Info
In a release build the two
bail_bug!s surface as traps. In a build with debug assertions they panic (bug.rs:63), asWasmtimeBug::newis written to do.
alexcrichton closed issue #15300:
cancel_wrong_end_busy.wast.txt
cancel_wrong_end_followon.wast.txtTest Case
;;! component_model_async = true ;; Case 1: stream.cancel-write on a readable end with a pending read. (component (type $t (stream u8)) (core module $libc (memory (export "mem") 1)) (core instance $libc (instantiate $libc)) (core func $new (canon stream.new $t)) (core func $read (canon stream.read $t async (memory (core memory $libc "mem")))) (core func $cancel (canon stream.cancel-write $t)) (core module $m (import "" "new" (func $new (result i64))) (import "" "read" (func $read (param i32 i32 i32) (result i32))) (import "" "cancel" (func $cancel (param i32) (result i32))) (func (export "f") (result i32) (local $new i64) (local $end i32) (local.set $new (call $new)) (local.set $end (i32.wrap_i64 (local.get $new))) ;; Start a read on the readable end. It blocks because nothing is written. (if (i32.ne (call $read (local.get $end) (i32.const 0) (i32.const 1)) (i32.const -1)) (then unreachable)) ;; Try to cancel a write on the readable end. (call $cancel (local.get $end)))) (core instance $i (instantiate $m (with "" (instance (export "new" (func $new)) (export "read" (func $read)) (export "cancel" (func $cancel)))))) (func (export "f") async (result u32) (canon lift (core func $i "f")))) (assert_trap (invoke "f") "passed read end to `{stream|future}.cancel-write`")The other three combinations are also affected:
stream.cancel-readon a writable end with a pending writefuture.cancel-writeon a readable end with a pending readfuture.cancel-readon a writable end with a pending writeThe complete test cases are attached in
cancel_wrong_end_busy.wast.Steps to Reproduce
wasmtime wast -W component-model-async=y cancel_wrong_end_busy.wastExpected Results
The call should trap because the handle refers to a readable end, but
cancel-writewas called.Actual Results
The call returns
CANCELLED(2) instead of trapping.Versions and Environment
- Wasmtime version or commit: main at c52bc6d8f (52.0.0-dev)
- Operating system: macOS 26.6
- Architecture: aarch64
Extra Info
In a release build the two
bail_bug!s surface as traps. In a build with debug assertions they panic (bug.rs:63), asWasmtimeBug::newis written to do.
Last updated: Nov 19 2026 at 20:05 UTC