Open
Description
I've recently had a issue when running a application on a single core machine (an old Raspberry Pi) where a Future would never finish. I have managed to reproduce the problem with the following small example on x64 as well:
use async_std::{fs, io::prelude::WriteExt};
#[async_std::main]
async fn main() {
let handle = async_std::task::spawn(async {
let mut handle = fs::OpenOptions::new()
.create(true)
.write(true)
.open("/tmp/foo")
.await
.unwrap();
handle.write_all(&[0; 313]).await.unwrap();
println!("Future finished!");
});
handle.await;
}
If this is executed while setting ASYNC_STD_THREAD_COUNT=1
the application doesn't finish. If I instead write to something else (like a Vec
) the application finishes as expected. Additionally if I use async_std::task::spawn_local
instead of spawn
or just await
the future in the main thread, the application also finishes as expected.
Here's the toml file:
[package]
name = "testing_async_std"
version = "0.1.0"
edition = "2018"
[dependencies]
async-std = { version = "=1.9.0", features = ["attributes"] }