Stream: general

Topic: ✔ Error: cannot reenter component instance


view this post on Zulip Tristan (Jan 17 2023 at 16:00):

Hi. I'm playing around with building a plugin interface using wasmtime, with wit-bindgen to (hopefully) give me access to the component-model types (strings and such). I've managed to dig my way to something that works for the guest (my plugin) to call host functions that give and take strings, and the host can call guest functions that take no arguments, but I'm getting a "cannot reenter component instance" error when trying to call guest functions that take arguments from the host.
I suspect this is a case of mismatched tooling support, since i'm using wasmtime main to get wasmtime::component::generate! for my host but using the latest wasm-tools from crates.io and wit-bindgen-guest-rust main for my guest. But there's also a large chance i'm just doing something wrong. My code is here https://github.com/tristan/wasm-plugin-experiment. :fingers_crossed: someone can either point out my mistake, or confirm for me I just need to take a break from it until the tooling is more aligned.

Contribute to tristan/wasm-plugin-experiment development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Jan 17 2023 at 16:04):

Are you able to perhaps turn on wasm backtraces and capture the error? If you're getting so far as "cannot reenter" you've got all the tooling versions aligned, but there may still be a bug in the component itself

view this post on Zulip Alex Crichton (Jan 17 2023 at 16:06):

Oh! Sorry no, you'll need to call .post_return() on component functions in the embedder if you're not invoking the functions through the generated bindings

view this post on Zulip Alex Crichton (Jan 17 2023 at 16:06):

which should fix your issue

view this post on Zulip Tristan (Jan 17 2023 at 18:05):

Yes! That fixed it. thanks! :praise:

view this post on Zulip Notification Bot (Jan 17 2023 at 18:57):

Tristan has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC