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
tokio::fs never waked up when ran by tokio::spawn #1851
Comments
I've run into a similar issue with the dns feature where a SocketAddr doesn't get resolved. This leads me to belive that this issues is related to the blocking feature. What I found interesting is that #[tokio::main]
async fn main() {
tokio::spawn(async move {
tokio::fs::read("./Cargo.toml").await.expect("read");
}).await.unwrap();
} does not terminate while #[tokio::main]
async fn main() {
tokio::fs::read("./Cargo.toml").await.expect("read");
} does. Feature are |
Same problem when running futures with |
The "global executor" thread-local is to track where to spawn new tasks, **not** which scheduler is active on the current thread. This fixes a bug with scheduling tasks on the basic_scheduler by tracking the currently active basic_scheduler with a dedicated thread-local variable. Fixes: #1851
Fix here: #1861 |
Works for me. Thank you! 👍 |
The "global executor" thread-local is to track where to spawn new tasks, **not** which scheduler is active on the current thread. This fixes a bug with scheduling tasks on the basic_scheduler by tracking the currently active basic_scheduler with a dedicated thread-local variable. Fixes: #1851
Version
with tokio 0.2.1 being selected.
Platform
Linux 5.0.0-36-generic 18.04.1-Ubuntu x86_64
Description
The
tokio::fs
operations I tested are not waked up when driven by tokio::spawn. The following tests block forever:Note that this is doesn't seem to be caused by the
#[tokio::test]
macro since I can replicate this behavior using#[tokio::main]
. Also it doesn't seem to be caused by theremote_handle
method either since I had the same behavior in one of my applications that doesn't use it. It seems that tokio::fs operations are simply not working when ran as a task inside tokio::spawn.The text was updated successfully, but these errors were encountered: