You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to #4377, which proposed warning about blocking operations like println! inside an async context. That is definitely a promising idea, but it's also very ambitious, because almost anything could block.
But there's also a specific set of blocking constructs that can potentially deadlock the entire tokio (or other) runtime. These include things like calling block_on or .wait inside an async context. There are easy to include by mistake when converting non-async code to async. And there are fewer of these dangerous calls, which would make them easier to lint for.
The text was updated successfully, but these errors were encountered:
emk
changed the title
Find "dangerous" blocking constructs in async contexts
Find "dangerous" blocking constructs in async contexts (.wait(), block_on, etc.)
Aug 21, 2019
emk
added a commit
to dbcrossbar/dbcrossbar
that referenced
this issue
Aug 21, 2019
Inside an `async` block, we're support to call `my_future.await`, and
_never_ use the sync-mode blocking equivalent `my_future.wait()`.
Apparently, doing this can deadlock the entire `tokio` runtime, or at
least the portions touching file I/O.
Fixes#16. Fixes#46.
We've also submitted a "lint" proposal to the clippy project which would
automatically detect errors of this class in the future:
rust-lang/rust-clippy#4427
This is related to #4377, which proposed warning about blocking operations like
println!
inside anasync
context. That is definitely a promising idea, but it's also very ambitious, because almost anything could block.But there's also a specific set of blocking constructs that can potentially deadlock the entire
tokio
(or other) runtime. These include things like callingblock_on
or.wait
inside anasync
context. There are easy to include by mistake when converting non-async
code toasync
. And there are fewer of these dangerous calls, which would make them easier to lint for.The text was updated successfully, but these errors were encountered: