Repository navigation
Use a multi-threaded Tokio runtime as a fallback - #8229
Merged
alexcrichton merged 1 commit intoMar 25, 2024
Merged
Conversation
This commit fixes a bug that was introduced in bytecodealliance#8190 and brought up on [Zulip]. In bytecodealliance#8190 there was a subtle change in how Tokio and the CLI are managed, namely that a Tokio runtime is installed at the start of the CLI to avoid entering/exiting the runtime on each blocking call. This had a small performance improvement relative to entering/exiting on each blocking call. This meant, though, that calls previously blocked with `Runtime::block_on` and now block with `Handle::block_on`. The [documentation of `Handle::block_on`][doc] has a clause that says that for single-threaded runtimes I/O and timers won't work. To fix this issue I've switch the fallback runtime to a multi-threaded runtime to ensure that I/O and timers continue to work. [Zulip]: https://bytecodealliance.zulipchat.com/#narrow/stream/219900-wasi/topic/Wasi-http.20requests.20hang/near/429187256 [doc]: https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.block_on
peterhuene
approved these changes
Mar 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes a bug that was introduced in #8190 and brought up on Zulip. In #8190 there was a subtle change in how Tokio and the CLI are managed, namely that a Tokio runtime is installed at the start of the CLI to avoid entering/exiting the runtime on each blocking call. This had a small performance improvement relative to entering/exiting on each blocking call. This meant, though, that calls previously blocked with
Runtime::block_onand now block withHandle::block_on. The documentation ofHandle::block_onhas a clause that says that for single-threaded runtimes I/O and timers won't work.To fix this issue I've switch the fallback runtime to a multi-threaded runtime to ensure that I/O and timers continue to work.