Stream: git-wasmtime

Topic: wasmtime / issue #14291 Missing API to drop guest Resourc...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2026 at 01:34):

SilverMira opened issue #14291:

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_

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

view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2026 at 16:00):

alexcrichton added the wasm-proposal:component-model-async label to Issue #14291.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2026 at 16:00):

alexcrichton added the wasmtime:api label to Issue #14291.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 19 2026 at 20:46):

Byte-Naut commented on issue #14291:

Thanks @SilverMira for tracking this down and @alexcrichton for pointing at
the shape of the missing API.

I've opened #<PR-NUMBER> which adds
ResourceAny::resource_drop_concurrent(self, accessor: impl AsAccessor).
It queues the drop on the store's worker fiber, so the Accessor::with
borrow ends before the await and nothing blocks the event loop. The
block_on workaround from the original report should no longer be needed.

I also added a test that reproduces the AccessorTask case from this issue,
and updated the resource_drop docs to explain when to use each of the
three variants, which touches on some of the documentation feedback from
#9946.

Feedback on the API or the cancellation semantics is very welcome.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 19 2026 at 20:50):

Byte-Naut edited a comment on issue #14291:

Thanks @SilverMira for tracking this down and @alexcrichton for pointing at the shape of the missing API.

I've opened #14362 which adds ResourceAny::resource_drop_concurrent(self, accessor: impl AsAccessor). It queues the drop on the store's worker fiber, so the Accessor::with borrow ends before the await and nothing blocks the event loop. The block_on workaround from the original report should no longer be needed.

I also added a test that reproduces the AccessorTask case from this issue, and updated the resource_drop docs to explain when to use each of the three variants, which touches on some of the documentation feedback from #9946.

Feedback on the API or the cancellation semantics is very welcome.


Last updated: Sep 20 2026 at 18:08 UTC