Bug #67782 MySQL 5.6.8-rc won't shut down if client is connected
Submitted: 1 Dec 2012 20:29 Modified: 17 Jan 2013 1:19
Reporter: Daniel Nichter Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.6.8-rc OS:MacOS
Assigned to: CPU Architecture:Any
Tags: mysqladmin, pid file, shutdown

[1 Dec 2012 20:29] Daniel Nichter
Description:
Running mysql-5.6.8-rc-osx10.6-x86_64, the server stalls on shutdown if a client is connected.  When "mysqladmin shutdown" is killed with CTRL-C it reports:

"""
Warning;  Aborted waiting on pid file: '/tmp/12348/data/mysql_sandbox12348.pid' after 196 seconds
"""

However I think that's wrong because the PID file is still there:

"""
12348$ ls data/*.pid
data/mysql_sandbox12348.pid
"""

The real problem is that MySQL is stalled on shutdown.  If no clients are connected, it always shuts down correctly.

This may be similar to bug 64643, but the fact that this bug is intermittent (i.e. sometimes MySQL actually kills the connected client but most times it doesn't) indicates that there's some problem.

Furthermore, if MySQL supposedly forcefully disconnected the client, (i.e. "121201 13:20:23 [Note] Forcefully disconnecting 1 remaining clients"), then what else is it waiting for?

Lastly, even if MySQL will eventually shut down after 3,600 second (1 hour) according to bug 64643, that is _way_ too long.  Imho, even after 5 minutes most people will think that MySQL has gotten stuck (particularly since there are no more log messages indicating why or for what it's waiting).

How to repeat:
1) Start a server.

2) Connect a client and leave it connected.

3) mysqladmin shutdown

The mysqladmin and mysqld hang now.  The MySQL log shows:

"""
121201 13:11:30 [Note] /Users/daniel/mysql-binaries/mysql-5.6.8-rc-osx10.6-x86_64/bin/mysqld: Normal shutdown

121201 13:11:30 [Note] Giving 1 client threads a chance to die gracefully
121201 13:11:30 [Note] Event Scheduler: Purging the queue. 0 events
121201 13:11:30 [Note] Shutting down slave threads
121201 13:11:32 [Note] Forcefully disconnecting 1 remaining clients
121201 13:11:32 [Warning] /Users/daniel/mysql-binaries/mysql-5.6.8-rc-osx10.6-x86_64/bin/mysqld: Forcing close of thread 2  user: 'msandbox'
"""

This happens most of the time, but every now and then it will work and the log will show that then:

"""
121201 13:10:40 [Note] Binlog end
121201 13:10:40 [Note] Shutting down plugin 'partition'
121201 13:10:40 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
121201 13:10:40 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
...
121201 13:10:40 [Note] Shutting down plugin 'InnoDB'
121201 13:10:40 [Note] InnoDB: FTS optimize thread exiting.
121201 13:10:40 [Note] InnoDB: Starting shutdown...
121201 13:10:42 [Note] InnoDB: Shutdown completed; log sequence number 1600634
121201 13:10:42 [Note] Shutting down plugin 'BLACKHOLE'
...
121201 13:10:42 [Note] Shutting down plugin 'binlog'
121201 13:10:42 [Note] /Users/daniel/mysql-binaries/mysql-5.6.8-rc-osx10.6-x86_64/bin/mysqld: Shutdown complete
"""
[1 Dec 2012 21:04] Daniel Nichter
I think this may only affect Mac OS X because shutdown works reliably using mysql-5.6.8-rc-linux2.6-x86_64 on Ubuntu 11.10.
[17 Dec 2012 1:19] MySQL Verification Team
I have not been able to reproduce this with 5.6.9-rc version. Can you try the latest release and see if it still produces the results you see?
[18 Jan 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".