-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
block_in_place
panic on runtime block_on
#1838
Comments
The panic message needs to be improved... and As a work around, you can do: let mut rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async move {
tokio::spawn(async {
tokio::task::block_in_place(|| println!("test"))
}).await
}) |
Is this a bug or intended behavior (and will it be different between the multithreaded and current_thread runtimes?) Aside from any |
the main difference is "block_in_place" moves any runtime infrastructure co-located on the thread to a different thread. It should be possible to implement this for everything except |
A nested |
@leotvyens that is unexpected. Would you mind filing a follow up issue? |
There's sometimes I can get the workaround to work, and other times I can't. The most common time this happens is in |
I also get the failure when moving the |
Had to change my |
Can this be considered fixed with #2410 ? |
I believe so 👍 |
version: tokio 0.2.1
feature: ["time", "io-util", "tcp", "dns", "rt-threaded", "blocking"]
output:
The cause of this problem is that the
ON_BLOCK
of the current thread is not set.Other workers
On_BLOCK
is set on here:tokio/tokio/src/runtime/builder.rs
Line 425 in 632ee50
But Runtime current thread not set on
block_on
function, is it a feature or a bug?The text was updated successfully, but these errors were encountered: