Skip to content
Discussion options

You must be logged in to vote

The example (1) also hangs forever on my side, see https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f09245299756bbc0838bcc56ea547342.

The reason example (1) hangs forever is that it shuts down the blocking thread pool. However, the blocking task itself hangs forever, so the shutdown process also hangs forever. See also Runtime::shutdown_background and Runtime::shutdown_timeout.

By default, [tokio::test] uses the current-thread runtime instead of the multi-thread runtime. Since run_app().await never resolves, example (2) also hangs forever.

In example (3), the sender gets dropped due to the panic!, which causes the receiver to close, and finally run_app().await resol…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Erik-Sovereign
Comment options

@Erik-Sovereign
Comment options

Answer selected by Erik-Sovereign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants