bytecodealliance / bytecodealliance/wasmtime

Missing API to drop guest ResourceAny concurrently

Open
#14,291 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:component-model-async wasmtime:api
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

> Hello, sorry for commenting on this old issue, but with the new `component-model-async` APIs, I couldn't find a way to drop a guest's resource, I'm within a `wasmtime::component::AccessorTask` with a guest exported `ResourceAny`, and I couldn't use `accessor.with(|store| resource.resource_drop_async(store))` due to trying to return a future that captures `store`.
>
> For now, I'm writing as `accessor.with(|store| futures::block_on(resource.resource_drop_async(store)))`, but no idea whether this is the intended way, or will it cause deadlocks because it will block the store's event loop

_Originally posted by @SilverMira in [#9946](https://github.com/bytecodealliance/wasmtime/issues/9946#issuecomment-5544839124)_

As confirmed by @alexcrichton in the above issue, Wasmtime doesn't yet have an intended way to drop a guest's `ResourceAny` within `Store::run_concurrent`

We probably need something like a `async fn resource_drop_concurrent(self, accessor: impl AsAccessor) -> wasmtime::Result<()>` on `ResourceAny`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.