Stream: git-wasmtime

Topic: wasmtime / PR #7199 Fix network tests in synchronous mode


view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 16:14):

alexcrichton opened PR #7199 from alexcrichton:yield-fixes-everything-right to bytecodealliance:main:

This commit is an attempt to fix some networking tests in synchronous mode in our test suite. Currently networking tests don't actually run in synchronous mode on CI which is why no failures have been surfaced yet, but the refactoring in #7182 is going to start doing this.

Currently the udp_sample_application.rs test blocks infinitely in synchronous mode for me locally, most of the time. This appears to be an interaction between how Tokio handles readiness and how we're entering the event loop. We're effectively entering the Tokio event loop with a future that's always ready which ends up starving Tokio of otherwise performing its background work such as updating flags for readiness of reading/writing.

The fix here is to add a yield at the start of an in_tokio block which is used in synchronous mode. This is a kludge fix but the intention is to enable Tokio to have a chance to update readiness flags and process events from epoll/kqueue/etc.

An additional fix to this issue is WebAssembly/wasi-sockets#64 where the test is waiting on READABLE or WRITABLE, but in this specific case it should only wait on READABLE. If it waited on just this then that would also fix this issue. Nevertheless having a yield_now is expected to have little-to-no overhead and otherwise fix this edge case of an always-ready future.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 16:14):

alexcrichton requested fitzgen for a review on PR #7199.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 16:14):

alexcrichton requested wasmtime-core-reviewers for a review on PR #7199.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 20:11):

alexcrichton closed without merge PR #7199.


Last updated: Nov 22 2024 at 16:03 UTC