Skip to content
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

task incorrectly(?) reported as being always busy #308

Open
doy opened this issue Mar 8, 2022 · 0 comments
Open

task incorrectly(?) reported as being always busy #308

doy opened this issue Mar 8, 2022 · 0 comments
Labels
S-bug Severity: bug

Comments

@doy
Copy link

doy commented Mar 8, 2022

What crate(s) in this repo are involved in the problem?

tokio-console, console-subscriber

What is the issue?

occasionally when running my application under tokio-console, i have been noticing that some tasks are always shown as being busy, when i don't believe that this is actually true

How can the bug be reproduced?

use futures_util::StreamExt as _;

#[tokio::main]
async fn main() {
    console_subscriber::init();
    tokio::spawn(async {
        tokio::task::spawn_blocking(move || loop {
            std::thread::sleep(std::time::Duration::from_secs(15));
        });

        let mut stream: futures_util::stream::SelectAll<_> =
            [futures_util::stream::once(std::future::pending::<()>())]
                .into_iter()
                .collect();

        while let Some(_res) = stream.next().await {
            unimplemented!()
        }
    })
    .await
    .unwrap();
}

i can't seem to minimize this any further, although i would be surprised if all of this was actually necessary to trigger this problem. removing the spawn_blocking call makes it stop happening, as does replacing the SelectAll with just the bare once stream. even with this example as it is, it only seems to trigger once every two or three runs.

Logs, error output, etc

console output when running the above example:

console

Versions

console-subscriber v0.1.3 (https://github.com/tokio-rs/console#be8bd8fc)
console-api v0.1.2 (https://github.com/tokio-rs/console#be8bd8fc)
tokio-console be8bd8fc741378f4ea8e84cc056614b47f174217

Possible solution

No response

Additional context

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=55e0c13c73383b434848068e001254aa seems to indicate that the task should not actually be blocked, which points more toward some kind of instrumentation issue

Would you like to work on fixing this bug?

no

@doy doy added the S-bug Severity: bug label Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-bug Severity: bug
Projects
None yet
Development

No branches or pull requests

1 participant