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

Got an error reading communication packets #208

Open
nbari opened this issue Jun 20, 2022 · 1 comment
Open

Got an error reading communication packets #208

nbari opened this issue Jun 20, 2022 · 1 comment

Comments

@nbari
Copy link

nbari commented Jun 20, 2022

When disconnection/closing the connection from the server-side I get this warning:

 [Warning] Aborted connection 14 to db: 'unconnected' user: 'root' host: '172.18.0.2' (Got an error reading communication packets)

At first, I thought it could be because of the HAProxy in front but after testing with the native MySQL client it works as expected, please here find a way to reproduce this behavior here: https://github.com/nbari/haproxy-mariadb

You can reproduce the same behavior with the app mycli

mycli -h 127.0.0.1 --port 3306 -uroot --pass secret

or with this rust example

use mysql_async::prelude::*;

#[tokio::main]
async fn main() {
    let opts = mysql_async::OptsBuilder::default()
        .user(Some("root"))
        .pass(Some("secret"))
        .db_name(Some("world"))
        .ip_or_hostname(String::from("127.0.0.1"))
        .tcp_port(3306)
        .stmt_cache_size(0);
    let mut conn = mysql_async::Conn::new(opts).await.unwrap();

    let version: Option<String> = conn.query_first("SELECT VERSION()").await.unwrap();
    drop(conn);
    println!("{}", version.unwrap());
}
@nbari
Copy link
Author

nbari commented Jun 23, 2022

From https://mariadb.com/kb/en/com_quit/:

int<1> 0x01 : COM_QUIT Header

I found here:

self.write_command_data(Command::COM_QUIT, &[]).await?;

Tried already with something like

 self.write_command_data(Command::COM_QUIT, &[1]).await?;

But no luck, any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant