| Bug #28609 | /etc/init.d/mysql doesn't stop if mysqld got down without clean up pid file | ||
|---|---|---|---|
| Submitted: | 23 May 2007 2:03 | Modified: | 2 Oct 2009 18:10 |
| Reporter: | Tetsuro Ikeda | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S4 (Feature request) |
| Version: | MySQL 5.0.40 RHEL4 RPM | OS: | Linux (Redhat Enterprise Linux 4) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | /etc/init.d/mysql stop, 5.0.40, Contribution, rpm | ||
[24 May 2007 5:54]
Valeriy Kravchuk
Thank you for a reasonable feature request and contributed patch.
[17 Jun 2009 21:13]
Liz Drachnik
Hello Tetsuro - In order for us to continue the process of reviewing your contribution to MySQL - Please review and sign the Sun|MySQL contributor agreement (the "SCA") The process is explained here: http://forge.mysql.com/wiki/Sun_Contributor_Agreement Thank you in advance - Liz Drachnik Program Manager - MySQL
[2 Oct 2009 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".

Description: /etc/init.d/mysql got in loop and can't finish, if mysqld got down without cleaning up pid file when this script is called. mysql script is provided by MySQL enterprise server for Redhat Linux 4 RPMs. This is because /etc/init.d/mysql think "If pid file exists, mysqld is alive. Let's wait mysqld got down by SIGTERM in loop". How to repeat: [root@tritonn-centos43 mysql]# service mysql start Starting MySQL [ OK ] [root@tritonn-centos43 mysql]# [root@tritonn-centos43 mysql]# ps aux | grep mysql root 6247 0.8 0.1 6784 1236 pts/1 S 11:48 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/tritonn-centos43.pid mysql 6288 2.6 1.2 117248 13284 pts/1 Sl 11:48 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/tritonn-centos43.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock root 6305 0.0 0.0 5756 636 pts/1 R+ 11:48 0:00 grep mysql [root@tritonn-centos43 mysql]# [root@tritonn-centos43 mysql]# kill -9 6247 [root@tritonn-centos43 mysql]# kill -9 6288 [root@tritonn-centos43 mysql]# [root@tritonn-centos43 mysql]# service mysql stop Shutting down MySQL/etc/init.d/mysql: line 336: kill: (6288) - No such process ..................................................................................... ..................................................................................... .......................... Suggested fix: How about checking return value from "kill $mysqlmanager_pid"? [root@tritonn-centos43 init.d]# diff -u /etc/init.d/mysql /etc/init.d/mysql.modified --- /etc/init.d/mysql 2007-05-23 10:52:34.000000000 +0900 +++ /etc/init.d/mysql.modified 2007-05-23 11:18:35.000000000 +0900 @@ -332,10 +332,16 @@ if test -s "$pid_file" then mysqlmanager_pid=`cat $pid_file` - echo $echo_n "Shutting down MySQL" kill $mysqlmanager_pid - # mysqlmanager should remove the pid_file when it exits, so wait for it. - wait_for_pid removed; return_value=$? + if test $? -eq 0 + then + echo $echo_n "Shutting down MySQL" + # mysqlmanager should remove the pid_file when it exits, so wait for it. + wait_for_pid removed; return_value=$? + else + return_value=$? + log_failure_msg "mysqld seems already got down." + fi # delete lock for RedHat / SuSE if test -f $lock_dir