bytecodealliance / bytecodealliance/wasmtime
Missing API to drop guest ResourceAny concurrently
- 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
Assessment
This issue has not been assessed yet.