Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Call finishes prematurely #73

@alexcrichton

Description

@alexcrichton

This input:

(component

  (component $child
    (core module $libc (memory (export "memory") 1))
    (core instance $libc (instantiate $libc))

    (core module $m
      (func (export "run") (result i32)
        i32.const 2 ;; CallbackCode.WAIT (or so I think)
      )

      (func (export "cb") (param i32 i32 i32 i32) (result i32)
        unreachable)
    )
    (core instance $i (instantiate $m))
    (func (export "run")
      (canon lift (core func $i "run") async (callback (func $i "cb"))))
  )
  (instance $child (instantiate $child))

  (core func $child-run (canon lower (func $child "run")))

  (core module $m
    (import "" "child-run" (func $child-run))

    (func (export "run")
      (call $child-run))
  )
  (core instance $i (instantiate $m
    (with "" (instance
      (export "child-run" (func $child-run))
    ))
  ))

  (func (export "run")
    (canon lift (core func $i "run")))
)

(assert_trap (invoke "run") "something i don't know what")

on this branch yields:

$ cargo run --manifest-path ../wasip3-prototyping/Cargo.toml --features component-model-async wast -W component-model-async ./test.wast
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
     Running `/home/alex/code/wasip3-prototyping/target/debug/wasmtime wast -W component-model-async ./test.wast`
Error: failed to run script file './test.wast'

Caused by:
    0: failed directive on ./test.wast:39:1
    1: expected trap, got Component([])

This was originally extracted from a wit-bindgen test I wrote but long story short is that the child task is never flagged as completed here but somehow returns to the main component. This is more-or-less a deadlock and should probably trap, or at least that was my rough expectation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions