dicej edited issue #13040:
While debugging https://github.com/tokio-rs/tokio/issues/8034, @alexcrichton and I determined that
wasmtime_wasi'swasi:clocks/monotonic-clock#{subscribe_instant,subscribe_duration}implementations can cause starvation when combined withwasi:io/poll#poll(on WASIp2). Likewise, on WASIp3, Wasmtime'swaitable-set.pollimplementation does not currently yield to the async runtime. Because those implementations do not yield at all for zero-duration waits, and becausetokio::task::yield_nowin guest code will poll with a zero timeout, the host will not yield to _it's_tokioruntime and givemioa chance to report readiness for one of the other pollables.The solution is for the host (i.e.
wasmtime_wasi) to calltokio::task::yield_new().awaitin that scenario before returning control to the guest to givemioa chance to run.
dicej added the wasm-proposal:component-model-async label to Issue #13040.
alexcrichton commented on issue #13040:
@dicej for wasip3, could a "store locking yield" be done for
waitable-set.poll? That way it doesn't affect wasm semantics at all, it can be done without depending ontokio, and it should serve the purpose of hitting the event loop and letting Tokio generate events.
dicej closed issue #13040:
While debugging https://github.com/tokio-rs/tokio/issues/8034, @alexcrichton and I determined that
wasmtime_wasi'swasi:clocks/monotonic-clock#{subscribe_instant,subscribe_duration}implementations can cause starvation when combined withwasi:io/poll#poll(on WASIp2). Likewise, on WASIp3, Wasmtime'swaitable-set.pollimplementation does not currently yield to the async runtime. Because those implementations do not yield at all for zero-duration waits, and becausetokio::task::yield_nowin guest code will poll with a zero timeout, the host will not yield to _it's_tokioruntime and givemioa chance to report readiness for one of the other pollables.The solution is for the host (i.e.
wasmtime_wasi) to calltokio::task::yield_new().awaitin that scenario before returning control to the guest to givemioa chance to run.
Last updated: May 03 2026 at 22:13 UTC