Bug #90281 mysqlsh \q command generates "aborted connections" notes in error log
Submitted: 2 Apr 2018 18:17 Modified: 9 May 2018 13:21
Reporter: Leonardo Abraham Figueroa Tapia Email Updates:
Status: Closed Impact on me:
None 
Category:Shell General / Core Client Severity:S4 (Feature request)
Version:1.0.11 OS:Any
Assigned to: CPU Architecture:Any

[2 Apr 2018 18:17] Leonardo Abraham Figueroa Tapia
Description:
Whenever a mysqlsh client closes its connection to a MySQL instance (for example, using the "\q" commmand), we are seeing a [NOTE] like the following in the error log:

2018-03-27T09:07:01.841209-08:00 417101 [Note] Aborted connection 417101 to db: 'unconnected' user: 'user1' host: 'localhost' (Got an error reading communication packets)

How to repeat:
1. Connect to a valid mysql server
mysql-js> \connect root@LEFIGUER-MX:24801

2. Exit the session:
mysql-js> \q

3. Look the error log for the [NOTE]
2018-04-02T18:11:53.426715Z 29 [Note] Aborted connection 29 to db: 'unconnected' user: 'root' host: 'LEFIGUER-MX.mx.oracle.com' (Got an error reading communication packets)

Suggested fix:
Seems like mysqlsh \q command doesn't close the mysql client session properly, it just exits the mysqlsh session, making mysql client to abruptly abort the session.

A suggested fix is that mysqlsh \q runs an "exit" command on the mysql client in order to clear the "aborted connections" messages in error log
[6 Apr 2018 7:44] MySQL Verification Team
Hello Leonardo,

Thank you for the report and feature request!
I have noticed that "Abort" note is logged not when you run "\q" but most likely when connected session exhausting number of seconds(interactive_timeout/wait_timeout) the server waits for activity on a noninteractive connection before closing it.

2018-04-06T07:34:37.595870Z 7 [Note] Aborted connection 7 to db: 'unconnected' user: 'root' host: 'localhost' (Got timeout reading communication packets)

When you execute "\q", normally below is logged:

2018-04-06T07:29:51.932078Z 0 [Note] Plugin mysqlx reported: 'X Plugin listens on TCP (bind-address:'::', port:33060)'
2018-04-06T07:29:51.932096Z 0 [Note] Plugin mysqlx reported: 'X Plugin listens on UNIX socket (/tmp/mysqlx.sock)'
2018-04-06T07:29:51.932164Z 0 [Note] Plugin mysqlx reported: 'Server starts handling incoming connections'

-- after \q from mysqlsh session (no matter tcp or socket connection session)

2018-04-06T07:30:58.466026Z 4 [Note] Plugin mysqlx reported: '1: ERROR reading from socket Connection reset by peer (104) 0'
2018-04-06T07:31:47.468486Z 5 [Note] Plugin mysqlx reported: '2: ERROR reading from socket Connection reset by peer (104) 0'
2018-04-06T07:35:14.941354Z 8 [Note] Plugin mysqlx reported: '3: ERROR reading from socket Connection reset by peer (104) 0'

Thanks,
Umesh
[6 Apr 2018 22:22] Leonardo Abraham Figueroa Tapia
Hello Umesh,

My mysql instance still logging aborted connection whenever I hit the \q from mysqlshell.
Do you know why am I getting this?
Also the customer who I raised the bug on behalf from was seeing this behavior, any clue about that?
SR - 3-17161610151
[8 May 2018 18:43] Juan Rene Ramirez Monarrez
Posted by developer:
 
This problem has been solved with a session handling refactoring done in 8.0
[9 May 2018 13:19] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.12:
When the \quit command was used to exit MySQL Shell, this event could be noted in the error log as an aborted connection. The issue has now been fixed.