Context cancelling cause close connection without sending COMM_QUIT for authenticated connection #1648
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
-
But cleanup() is only called before auth or on auth failure
Lines 134 to 138 in c9f41c0
-
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