-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Connections stuck with "busy buffer" after ErrPktSync #1394
Milestone
Comments
This was referenced Aug 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
In #1393, I described a situation that can frequently cause
ErrPktSync
errors in very busy services, when the local timeout is greater than thewait_timeout
.In one service, we saw this triggering huge bursts of "busy buffer" log messages and "invalid connection" errors. This is because:
ErrPktSync
error here, the connection is not closed and the buffer is left filled.IsValid()
returnstrue
(because the connection is not closed).ResetSession()
doesn't reset the buffer.interpolateParams()
returnsErrInvalidConn
without closing the connection, which brings us back to step 2.Almost 100% of our queries were using
interpolateParams
, so we'd essentially get stuck in this cycle until the connection timed out.It seems like one of the simplest things to do might be to clear the buffer in
ResetSession()
, since it's only at that point we know that any previous queries are no longer relevant.Example code
Use https://github.com/lukaszlach/docker-tc to apply a network delay to the MySQL container:
Start the MySQL container in a network, with a 1 second network delay applied:
Error log
Configuration
Driver version (or git SHA): 1.7.0
Go version: 1.19.5
Server version: MySQL 8.0.24
Server OS: Ubuntu 18.04.1
The text was updated successfully, but these errors were encountered: