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
orWRITABLE
, but in this specific case it should only wait onREADABLE
. If it waited on just this then that would also fix this issue. Nevertheless having ayield_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:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested fitzgen for a review on PR #7199.
alexcrichton requested wasmtime-core-reviewers for a review on PR #7199.
alexcrichton closed without merge PR #7199.
Last updated: Nov 22 2024 at 16:03 UTC