Bug #54035 msyqld_safe behaviour consumes too much CPU if it is unable to restart mysqld
Submitted: 27 May 2010 15:04 Modified: 26 Jan 2012 16:09
Reporter: Roger Nay Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: General Severity:S4 (Feature request)
Version:All OS:Any (most, not windows)
Assigned to: Nirbhay Choubey CPU Architecture:Any
Triage: Needs Triage: D5 (Feature request)

[27 May 2010 15:04] Roger Nay
If mysqld is unable to restart, for reasons such as a LVM file system problem. Then the msyqld_safe script keeps trying to restart it eating up all of the CPU.

How to repeat:
Use an LVM snapshot for the file system. When the space allocated to the snapshot logical volume runs out, as expected the file system disappears. This causes mysqld to die, and then mysqld_safe attempts to start it up again. As the filesystem is no longer readable this fails and the process repeats forever.

Suggested fix:
Put in a 1 second pause to that all of the CPU isn't taken up.
[27 May 2010 15:12] Valeriy Kravchuk
Thank you for the feature request.
[26 Jan 2012 16:09] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

[26 Jan 2012 16:10] Jon Stephens
Documented fix in the 5.5.21 and 5.6.5 changelogs as follows:

        It was possible in the event of successive failures for
        mysqld_safe to restart quickly enough to consume excessive
        amounts of CPU. Now, on systems that support the sleep and date
        utilities, mysqld_safe checks to see whether it has restarted
        more than 5 times in the current second, and if so, waits 1
        second before attempting another restart.