-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
100% cpu usage when send data with channel.data #266
Comments
Could you please take a profile of your program to see where it's looping? |
How can I do that? |
Is it enough?
|
There is also additional context of this problem. Probably root reason is target device. |
I'm facing the same issue - 100% CPU usage (single core) when awaiting In comparison, Minimal example: use async_trait::async_trait;
use russh::client;
use russh::client::Config;
use russh_keys::key;
use std::sync::Arc;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let addrs = ("10.0.0.123", 22);
let mut session = client::connect(Arc::new(Config::default()), addrs, Client).await?;
let auth_ok = session.authenticate_password("user", "pass").await?;
if !auth_ok {
anyhow::bail!("auth failed");
}
let channel = session.channel_open_session().await?;
channel.exec(true, "cat > /dev/null").await?;
let infinite_data = tokio::io::repeat(b'A');
println!("sending data");
channel.data(infinite_data).await?;
unreachable!();
}
struct Client;
#[async_trait]
impl client::Handler for Client {
type Error = russh::Error;
async fn check_server_key(
&mut self,
_server_public_key: &key::PublicKey,
) -> Result<bool, Self::Error> {
Ok(true)
}
} (I'm using russh Flamegraph: flamegraph.svg.gz I generated the flamegraph using I also turned on debuginfo in the release profile: # Cargo.toml
[profile.release]
debug = true |
Recently I got strange behavior on my app, it can stuck with 100% cpu usage forever, and only restart of proccess can fix that.
After some investigations, I found that it happens here:
Debug log:
log.txt
The text was updated successfully, but these errors were encountered: