Bug #49772 Incorrect shutdown logic in mysql.server script
Submitted: 17 Dec 2009 15:24 Modified: 7 Jan 2010 16:40
Reporter: Ivan Debnar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.5m2 OS:Any (Sun Solaris 10u8, Linux)
Assigned to: Alexander Nozdrin
Tags: mysql.server startup shutdown script, regression
Triage: Triaged: D2 (Serious)

[17 Dec 2009 15:24] Ivan Debnar
Description:
The startup / shutdown script in support-files/mysql.server contains serious logical bug in 'stop' function.

On line 306 there is "kill -9 $mysqld_pid " ...

This does not allow mysqld to finish correctly, safe_mysqld instantly starts another instance and databases need recovery after incorrect shutdown.

Simple workaround is to remove "-9"  and let mysqld finish its shutdown correctly.

In 5.4 there was not the -9 in stop function neighter.

How to repeat:
Start the server 
/opt/mysql/mysql/support-files/mysql.server start

stop it with 
/opt/mysql/mysql/support-files/mysql.server stop

the mysqld is restarted ( not stopped ) and error log contains error aboun incorrect shutdown.

Suggested fix:
Remove -9 from line 306 in this script - in "stop" function.
[17 Dec 2009 19:17] Sveta Smirnova
Thank you for the report.

Verified as described by reading the code.
[19 Dec 2009 14:24] Valerii Kravchuk
Bug #49822 was marked as a duplicate of this one.
[23 Dec 2009 9:55] Alexander Nozdrin
The bug was fixed by Jonathan Perkin on Dec-16
in mysql-trunk-bugfixing.

revid: jperkin@sun.com-20091216102756-r2v48umkl77ky05f
message:
  Fix previous merge: 'kill -0' (check PID exists) was changed to 'kill -9',
  meaning a '/etc/init.d/mysql stop' would actually cause mysqld_safe to
  relaunch mysqld rather than shut it down.

The patch was pushed into mysql-trunk and merged into mysql-next-mr and
mysql-6.0-codebase.
[7 Jan 2010 16:40] Paul Dubois
Noted in 5.5.1, 6.0.14 changelogs.

The mysql.server script had incorrect shutdown logic.