zacharywhitley opened PR #12515 from tegmentum:fix/skip-async-cleanup-when-disabled to bytecodealliance:main:
Summary
When the
component-model-asyncfeature is compiled in but the store was created without concurrency support,concurrent_stateisNone. DuringStore::drop,drop_fibers_and_futuresis called which then callsconcurrent_state_mut(). This panics becauseconcurrent_state_mut()unwraps theNonevalue.This fix adds a runtime check to early-return when
concurrency_support()returnsfalse, preventing the panic during Store drop.Problem
In
crates/wasmtime/src/runtime/store.rs:pub(crate) fn concurrent_state_mut(&mut self) -> &mut concurrent::ConcurrentState { debug_assert!(self.concurrency_support()); self.concurrent_state.as_mut().unwrap() // Panics if concurrent_state is None }The
debug_assert!only catches this in debug builds, but in release builds theunwrap()will panic.Fix
Add a guard in
drop_fibers_and_futures:pub(crate) fn drop_fibers_and_futures(store: &mut dyn VMStore) { if !store.concurrency_support() { return; } // ... rest of cleanup }Test Plan
- Builds successfully with
cargo check -p wasmtime --features component-model,component-model-async,async- Confirmed fix prevents panic when dropping stores created without concurrency support
zacharywhitley requested fitzgen for a review on PR #12515.
zacharywhitley requested wasmtime-core-reviewers for a review on PR #12515.
github-actions[bot] added the label wasmtime:api on PR #12515.
alexcrichton commented on PR #12515:
Can you add a test for this as well? Somewhere in
tests/all/*.rsfor example
Last updated: Feb 24 2026 at 04:36 UTC