-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Issue description
startWatcher() watches the context provided by the Go client. When context cancellation occurs, this method only cleanup() the connection without sending COMM_QUIT, regardless of whether the connection has already been authenticated or not.
Without COMM_QUIT, MySQL Server will abort authenticated clients, and increase Aborted_clients metric.
Related code
-
Current handling when context cancel:
Lines 439 to 441 in c9f41c0
func (mc *mysqlConn) cancel(err error) { mc.canceled.Set(err) mc.cleanup()
-
But cleanup() is only called before auth or on auth failure
Lines 134 to 138 in c9f41c0
// Closes the network connection and unsets internal variables. Do not call this // function after successfully authentication, call Close instead. This function // is called before auth or on auth failure because MySQL will have already // closed the network connection. func (mc *mysqlConn) cleanup() {
-
Close() should be called if the connection has been authenticated successfully with sending COMM_QUIT to MySQL server
Error log
If you have an error log, please paste it here.
Configuration
Driver version (or git SHA): 1.8.1
Go version: run go version
in your console
Server version: E.g. MySQL 5.6, MariaDB 10.0.20
Server OS: E.g. Debian 8.1 (Jessie), Windows 10