jonhoo / msql-srv

Bindings for writing a server that can act as MySQL/MariaDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect handling of server system variables

avn-tnl opened this issue · comments

A recent update of mysql_async (0.32.2) consolidated multiple server system variable queries into one:

let settings: Option<Row> = if read_socket || read_max_allowed_packet || read_wait_timeout {
    self.query_internal("SELECT @@socket, @@max_allowed_packet, @@wait_timeout")
        .await?
} else {
    None
};

https://github.com/blackbeam/mysql_async/blob/e6bbf7c776374d0067c0164245e9158b5c75f7e7/src/conn/mod.rs#L970

This query is not handled correctly, as the responsible for this accepts only the following query:

SELECT @@max_allowed_packet

if q.starts_with(b"SELECT @@") || q.starts_with(b"select @@") {

This in turn triggers a bug in mysql_async, preventing the creation of a new connection (which is fixed in the next version blackbeam/mysql_async#263). However, the handling of the max_allowed_packet in msql-srv should probably be corrected or removed.

Ah, yes, the code near there should probably be updated to split by , and walk, match on, and emit values for all the fields (if a reasonable response value is known). PRs welcome!