-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Only create ConcurrentState in a Store when CM async is enabled
#12377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only create ConcurrentState in a Store when CM async is enabled
#12377
Conversation
e580461 to
617ebec
Compare
Creating the default `ConcurrentState` will create a `FuturesUnordered` which will allocate. By making this state optional, we can keep making progress on bytecodealliance#12069, and put off dealing with `FuturesUnordered` until when we are ready to try and make CM async code handle OOMs.
617ebec to
3ce619b
Compare
|
So I got things working, but I had to effectively turn |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
DetailsTo modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
dicej
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Regarding the WAST test failures: now that the component model combines resource, task, thread, future, stream, and error-context handles all into a single table, tests involving those handles can be sensitive to whether or not e.g. a thread handle has been implicitly allocated as part of a call. For example, the first resource handle created by a guest will have a value of 1 if a thread handle was not allocated (i.e. because CM concurrency is disabled), but it will have a value of 2 if a thread handle was allocated. Also, Wasmtime makes the distinction between "not a valid handle at all" and "a valid handle, but not of the expected kind (e.g. a thread handle being used as a resource handle)".
I made this update as part of #12379; I suspect we'll need to do the same here. In some cases, that might mean explicitly enabling CM async for a given WAST (assuming it's been written with the assumption that a thread handle is allocated for each guest call). In other cases, it might mean changing the expected trap message and/or expected handle values. I can tackle that, if you'd like.
|
Thanks! Flagging the two offending wast tests as requiring CM async was straightforward and resolved the issues |
| .common | ||
| .config(use_pooling_allocator_by_default().unwrap_or(None))?; | ||
| config.wasm_component_model(true); | ||
| config.wasm_component_model_async(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this was enabled? For debugging, or intentional?
As an unstable feature this is something I'd ideally like to keep turned off until component-model-async is ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasmtime serve and wasi-http unconditionally use the concurrency machinery today. We don't have a separate switch for the internal concurrency machinery vs the Wasm-facing component model async feature. Probably we need something like GC_TYPES, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm ok yeah I think we'll definitely want something disconnected from wasm feature validation for this. I'll work on that.
Creating the default
ConcurrentStatewill create aFuturesUnorderedwhich will allocate. By making this state optional, we can keep making progress on #12069, and put off dealing withFuturesUnordereduntil when we are ready to try and make CM async code handle OOMs.