Bug #31575 MySQL startup script hangs if mysqld was killed
Submitted: 13 Oct 2007 1:25 Modified: 10 Dec 2008 20:19
Reporter: Alexander Rubin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.45, 5.0, 5.1, 6.0 bzr OS:Linux
Assigned to: CPU Architecture:Any
Tags: startup script

[13 Oct 2007 1:25] Alexander Rubin
Description:
If mysqld was killed, and pid file and lock files exists, /etc/init.d/mysql stop
will wait until timeout (default for 5.0.45 is 900 seconds) and finally returns error code 1.

This is bad for DRBD/HeartBeat installations. If mysql was killed or have dies, HeartBeat will try to stop mysql and will make 10 attempts: 10x900sec.
As /etc/init.d/mysql stop will return error code 1, HeartBeat will not failover to  another host due to stop failure. 

In addition, there is no way to set different variables for stop and for start timeout. 

How to repeat:
killall -9 mysqld_safe
killall -9 mysqld
/etc/init.d/mysql stop

Suggested fix:
1. Check if mysqld process is running or not and/or return 0 in case of timeout.
2. Use "start_timeout" and "stop_timeout" variables
[13 Oct 2007 1:29] Monty Taylor
I've got some code in a branch to work on this some. I'll try to clean it up and check it in soon.
[10 Oct 2008 9:12] Sveta Smirnova
Thank you for the report.

Verified as described.
[5 Dec 2008 19:18] Chad MILLER
I thought I fixed this in Bug#30378.
[9 Dec 2008 6:55] Sveta Smirnova
Alexander,

what is the main problem? What is mysql.server waits until timeout (not repeatable) or what it returns exit code 1?
[10 Dec 2008 20:13] Alexander Rubin
Ok, this is fixed in 5.0.67 and 5.1.30:
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL/etc/init.d/mysql: line 359: kill: (3330) - No such process
Manager of pid-file quit without updating file.            [FAILED]
[root@localhost ~]# echo $?
1

It is returning error code "1" which is actually right, as the startup script was unable to stop mysql. So I would consider this bug to be fixed. Thank you!
[10 Dec 2008 20:19] Sveta Smirnova
Closed as "Can't repeat"