-
Notifications
You must be signed in to change notification settings - Fork 977
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
Invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF #3698
Comments
javsanpar
added a commit
that referenced
this issue
Nov 28, 2022
Fix invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF. Otherwise, if a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect. The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
javsanpar
added a commit
that referenced
this issue
Nov 28, 2022
Fix invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF. Otherwise, if a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect. The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
javsanpar
added a commit
that referenced
this issue
Dec 6, 2022
Fix invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF. If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect. The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
javsanpar
added a commit
that referenced
this issue
Dec 6, 2022
Fix invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF. If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect. The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
javsanpar
added a commit
that referenced
this issue
Dec 7, 2022
Fix invalid resultset when using query cache and mixing clients using and not using CLIENT_DEPRECATE_EOF. If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect. The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If a client connects to ProxySQL not using CLIENT_DEPRECATE_EOF and it caches a resultset, when a client using CLIENT_DEPRECATE_EOF executes the same query it will get an invalid resultset and the client will disconnect.
The data in the resultset is correct, but proxysql skips a sequence id thus the client assumes it is corrupted.
From 2.1.0 to 2.3.2
Any.
Have two mysql clients, one not using CLIENT_DEPRECATE_EOF and one using CLIENT_DEPRECATE_EOF .
For example, using mysql client binary for 5.6 and 8.0 .
We can use dbdeployer for this.
Have a very basic proxysql installation with 1 backend and 1 user, and create a query rule to enable query caching (for simplicity, on every SELECT):
Run a
SELECT 1
using an old mysql client (not usingCLIENT_DEPRECATE_EOF
), then run the same query using a client usingCLIENT_DEPRECATE_EOF
:The resultset captured by
tcpdump
when using 5.6.44 client :The resultset captured by
tcpdump
when using 8.0.22 client :For reference to MySQL Protocol:
https://dev.mysql.com/doc/internals/en/mysql-packet.html
https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::Resultset
The resultset sent to 8.0.22 is missing the first EOF packet: this is expected!
But the following packet should use sequence ID number 3 , instead it uses sequence ID number 4.
/var/lib/proxysql/proxysql.log
)The full error log it is not relevant. What is relevant is that the client disconnects:
root cause
The problem originates in eof_to_ok_packet that simply skip the first EOF packet and copies the rest.
solution
In function
eof_to_ok_packet()
should, after copying the resultset, we must change and reduce by one each packet following the skipped EOF packet.We should scan all the packets reading the header, computing the length, jumping to the next packet header, and repeat until we reach the end.
It is important to remember that sequence ID ranges from 0 to 255 and then it rolls over.
The text was updated successfully, but these errors were encountered: