Fix mysql reconnection test: proxy must close both sides on planned disconnect#49
Draft
Fix mysql reconnection test: proxy must close both sides on planned disconnect#49
Conversation
…nection testing Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix MySQL test failure in CI pipeline
Fix mysql reconnection test: proxy must close both sides on planned disconnect
Mar 2, 2026
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.
pitr_binlog_server_reconnection_test.shconsistently failed with ~286/301 rows replicated becausebinlog_proxy.pywas reconnecting only the server-side socket while keeping the MySQL client connection open.Root cause
When the proxy triggered a planned disconnect, it closed and reopened its connection to the wal-g binlog server while holding the MySQL connection. The binlog server immediately issued a fresh MySQL protocol handshake on the new TCP connection; the proxy dutifully forwarded that handshake to MySQL—which was mid-stream expecting binlog events. MySQL's IO thread flagged a protocol violation, entered
Connectingstate, and never recovered through the same session.Fix
On a planned disconnect, close both the client and server sockets and return from
handle_client_connection. The outerstart()accept loop then picks up MySQL's standard reconnect (governed byMASTER_CONNECT_RETRY/MASTER_RETRY_COUNT), which carries the correct GTID set and triggers a properCOM_BINLOG_DUMP_GTIDagainst the binlog server's existing streamer.Because the 256-byte threshold fires during the TCP auth phase (before
COM_BINLOG_DUMP_GTID), the two planned disconnects occur before replication actually starts. The third connection operates in stable mode and replicates all 301 rows cleanly.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.