fix: skip drop_fibers_and_futures when concurrency support is disabled#12515
Open
zacharywhitley wants to merge 1 commit intobytecodealliance:mainfrom
Open
fix: skip drop_fibers_and_futures when concurrency support is disabled#12515zacharywhitley wants to merge 1 commit intobytecodealliance:mainfrom
zacharywhitley wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
When the component-model-async feature is compiled in but the store was created without concurrency support (e.g., via Config tuning), concurrent_state is None. Calling concurrent_state_mut() in this case would panic due to the unwrap() on None. This fix adds a runtime check to early-return when concurrency_support is false, preventing the panic during Store drop.
Member
|
Can you add a test for this as well? Somewhere in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: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:Test Plan
cargo check -p wasmtime --features component-model,component-model-async,async