bytecodealliance / bytecodealliance/wasmtime

Async libcalls "block" the store from making progress on concurrent tasks

Open
#11,869 10 comments 1 reaction 0 assignees View on GitHub
wasm-proposal:component-model-async
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

At this time the implementation of async libcalls in Wasmtime all use the `block_on` helper internally in the implementation. This has the property, though, that the store is "locked" while the libcall is waiting on the result meaning that in a component-model-async world it's not possible to make progress on anything else in the store while this is happening. This notably affects `Store::run_concurrent` as well where any select-ed async computation won't make progress because the wasm is locking up everything.

To fix this it will require async libcalls to be refactored/reimplemented to not close over the store for the duration of their execution. Instead something like `Accessor` will be required where mutable access to a store can be temporarily granted but otherwise it's not held across `await` points. In implementing this it'll fix `run_concurrent` to correctly and actually run various computations in the provided closure concurrently. This will also enable other concurrent tasks within the store to make progress while a libcall is blocked.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.