We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Version List the versions of all tokio crates you are using. The easiest way to get this information is using cargo tree subcommand:
tokio
cargo tree
cargo tree | grep tokio
tokio = { version = "1", features = ["full"] }
Platform The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
uname -a
uname -a Darwin 6c7e67b9eeac 22.6.0 Darwin Kernel Version 22.6.0: Thu Nov 2 07:43:25 PDT 2023; root:xnu-8796.141.3.701.17~6/RELEASE_ARM64_T6020 arm64
Description Enter your issue details here. One way to structure the description:
Time does not advance with a paused runtime when a spawn_blocking task is running (or blocking).
This seems related to: #5115
I tried this code:
#[test] fn spawn_blocking() { let rt = tokio::runtime::Builder::new_current_thread() .enable_time() .start_paused(true) .build() .unwrap(); let _g = rt.enter(); let ls = tokio::task::LocalSet::new(); ls.spawn_local(async { tokio::task::spawn_blocking(|| { println!("{:?}: parking...", std::thread::current().name()); std::thread::park() }); }); rt.block_on(async { println!("{:?}: run_until for 10ms", std::thread::current().name()); ls.run_until(tokio::time::sleep(Duration::from_millis(10))) .await; println!("run_until done"); }); }
I expected to see this happen: I'd expect the run_until to complete, albeit instantaneously,
run_until
Instead, this happened: "run_until done" never emits
The text was updated successfully, but these errors were encountered:
It's because time is paused. Time does not advance if there are any spawn_blocking tasks.
spawn_blocking
Sorry, something went wrong.
Closing as working-as-intended.
No branches or pull requests
Version
List the versions of all
tokio
crates you are using. The easiest way to getthis information is using
cargo tree
subcommand:cargo tree | grep tokio
Platform
The output of
uname -a
(UNIX), or version and 32 or 64-bit (Windows)Description
Enter your issue details here.
One way to structure the description:
Time does not advance with a paused runtime when a spawn_blocking task is running (or blocking).
This seems related to: #5115
I tried this code:
I expected to see this happen: I'd expect the
run_until
to complete, albeit instantaneously,Instead, this happened: "run_until done" never emits
The text was updated successfully, but these errors were encountered: