Repository navigation
Conversation
Some proxies and servers (e.g. Aliyun RDS for MySQL 5.6) advertise CLIENT_DEPRECATE_EOF but still end result sets with legacy EOF packets, so every query fails with "OK_Packet too short". MySqlConnectOptions::deprecate_eof(false) connects without requesting the capability, like mysql_async's option of the same name. The default is unchanged. Closes transact-rs#4507
l0ng-ai
added a commit
to l0ng-ai/openidea
that referenced
this pull request
Nov 13, 2026
…but send EOF packets (#3030) Some servers and proxies (Aliyun RDS for MySQL 5.6) advertise CLIENT_DEPRECATE_EOF but still end result sets with legacy EOF packets; sqlx requested every advertised capability, so every query failed with "OK_Packet too short". sqlx now comes from l0ng-ai/sqlx at a rev adding MySqlConnectOptions::deprecate_eof (proposed upstream as transact-rs/sqlx#4524), and opening a MySQL pool retries once without the capability when the first connection fails with that error. Fixes #1053
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does your PR solve an issue?
fixes #4507
Adds
MySqlConnectOptions::deprecate_eof(bool)(defaulttrue, so nothing changes unless it is set) and adeprecate-eof/deprecate_eofURL parameter. When it isfalse, the client doesn't requestCLIENT_DEPRECATE_EOFeven if the server advertises it, so result sets are read with legacy EOF packets — the same opt-out mysql_async offers for proxies that advertise the capability but still send EOF packets. Not requesting a capability is always valid for the server, and no protocol parsing changes: the existing non-DEPRECATE_EOFpath (used for servers that don't advertise it) handles the rest.Tests:
options::parse::it_parses_deprecate_eof: the URL parameter, the default, and the round trip throughbuild_url.tests/mysql/mysql.rs::it_reads_result_sets_without_deprecate_eof: connects withdeprecate_eof(false)and reads a multi-row result, a multi-statement result and a prepared statement. Run locally against MySQL 8.4 and 5.6 (Docker).mysql:5.6behind a TCP proxy that sets bit 24 in the greeting (the case in MySQL: option to not request CLIENT_DEPRECATE_EOF for servers that advertise it but send legacy EOF packets #4507), every query fails withOK_Packet too short: … got 2by default and works withdeprecate_eof(false).Is this a breaking change?
No. A new option whose default keeps the current behaviour;
MySqlConnectOptionsfields arepub(crate), so adding one doesn't affect users.