Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Cannot leave component instance issue #97

@Mossaka

Description

@Mossaka

Hey, not sure if this is the right place to ask but the issue was caused when wasm32-wasi target is used in my case.

I tried to execute a wasi component using the host crate from this repo and I got a message showed below

(base) ➜  wasi-messaging-demo git:(main) ✗ make run 
Running...
    Finished dev [unoptimized + debuginfo] target(s) in 1.90s
     Running `target/debug/host`
Error: error while executing at wasm backtrace:
    0: 0x288de2 - wit-component:shim!indirect-wasi-environment-get-environment
    1: 0x2871b7 - wit-component:adapter:wasi_snapshot_preview1!wasi_snapshot_preview1::State::get_environment::h1684658e26d89eb6
    2: 0x2873ab - wit-component:adapter:wasi_snapshot_preview1!environ_sizes_get
    3: 0x288e0a - wit-component:shim!adapt-wasi_snapshot_preview1-environ_sizes_get
    4: 0x1d003 - <unknown>!__wasi_environ_sizes_get
    5: 0x1d06a - <unknown>!__wasilibc_initialize_environ
    6: 0x1d10a - <unknown>!__wasilibc_initialize_environ_eagerly
    7:  0x9a8 - <unknown>!__wasm_call_ctors
    8: 0x23a1f - <unknown>!cabi_realloc.command_export

Caused by:
    cannot leave component instance
make: *** [run] Error 1

The setup

I am using the 'release-6.0.0' branch of wasmtime and the latest commits of this repo and wit-bindgen, wasm-tools for creating a component out of my Rust application.

This is the output of wasm-tools component wit

...
default world guest.component {
  import messaging-types: self.messaging-types
  import producer: self.producer
  import wasi-stderr: self.wasi-stderr
  import wasi-io: self.wasi-io
  import wasi-filesystem: self.wasi-filesystem
  import wasi-exit: self.wasi-exit
  import wasi-environment: self.wasi-environment
  export handler: self.handler
}

My host is building a Wasi Context using wasi_cap_std_sync crate from this repo as well.

Getting Around

I was able to get around this error by compiling the application to wasm32-unknown-unknown target and remove --adapt flag from wasm-tools component command. This indicates that there might be something going on in wasi and thus I want to raise this issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions