Bug #30021 Server init.d script stop leaves dead server process running
Submitted: 25 Jul 2007 1:06 Modified: 31 Aug 2007 3:13
Reporter: Adam Donnison Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.20 OS:Linux (Fedora Core)
Assigned to: CPU Architecture:Any

[25 Jul 2007 1:06] Adam Donnison
Description:
On 4 out of 6 servers running 5.1.20, 'service mysql stop' or running '/etc/init.d/mysql stop' leaves both mysqld and mysqld_safe processes.  Starting the service again results in multiple copies of mysqld and mysqld_safe running.

kill with default signal (SIGTERM) does nothing, SIGKILL is required.

Interestingly running strace against the mysqld process also causes it to die with the following output:

Process 3594 attached - interrupt to quit
select(16, [14 15], NULL, NULL, NULL)   = -1 EBADF (Bad file descriptor)
gettimeofday({1185316956, 508069}, NULL) = 0
exit_group(0)                           = ?
Process 3594 detached

How to repeat:
As root on a Fedora Core system with mysql running, issue the command:

service mysql stop

Wait until you get the OK, then issue the command:

ps -ef|grep mysqld

Shows both mysqld and mysqld_safe running.

Suggested fix:
Add a valid timeout to the select call on the unix and TCP sockets.  It may be that the infinite timeout is causing the exit to be blocked until some other process causes an interrupt in the select.
[31 Jul 2007 3:13] Valeriy Kravchuk
Thank you for a problem report. Please, send the results of:

uname -a
cat /etc/issue
getconf GNU_LIBPTHREAD_VERSION
getconf GNU_LIBC_VERSION

from all the system affected and NOT affected by this bug.
[31 Aug 2007 23: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".