[MDEV-3279] LP:675185 - [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU Created: 2010-11-14  Updated: 2018-06-05  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jakob Unterwurzacher (Inactive) Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug675185.xml     File LPexportBug675185_fix.diff    

 Description   

Symptoms are: After mysql server upgrades + restarts the old mysqld_safe keeps running and consumes 100% cpu, strace shows:
wait4(4294967295, 0x7fffb3b3d59c, 0, NULL) = -1 ECHILD (No child ...
wait4(4294967295, 0x7fffb3b3d59c, 0, NULL) = -1 ECHILD (No child ...
wait4(4294967295, 0x7fffb3b3d59c, 0, NULL) = -1 ECHILD (No child ...
For more info see the dupes, particularily bug 105457. Does not happen always, for reliable test case see below.

This is a bug (race condition) in dash, partly fixed by http://git.kernel.org/?p=utils/dash/dash.git;a=commit;h=3800d4934391b144fd261a7957aea72ced7d47ea . This fixes the test case and mysqld_safe, but introduces another regression: http://eeek.borgchat.net/lists/dash/msg00268.html (patch for that in the thread)

TEST CASE: Script in the commit message (link above). Allows to reproduce this always, even on Karmic still.

(Proposed fix of using #Unable to render embedded object: File (/bin/bash instead of #) not found./bin/sh is not as straigtforward as expected. bash called as sh goes into sh compatibility mode, called as bash it may behave subtle differently)

NOTES: mysqld_safe was replaced by an upstart job in Lucid. But Hardy has support for 3 more years, justifiying a fix.



 Comments   
Comment by Jakob Unterwurzacher (Inactive) [ 2010-11-14 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU

Comment by Jakob Unterwurzacher (Inactive) [ 2010-11-14 ]

fix.diff
LPexportBug675185_fix.diff

Comment by Rasmus Johansson (Inactive) [ 2010-11-15 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
Thanks for the patch, can you follow the process outlined by:

https://wiki.ubuntu.com/StableReleaseUpdates

thanks

chuck

Comment by Rasmus Johansson (Inactive) [ 2010-11-16 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
Be sure to verify that the script works with bash's non-POSIX mode as well. A not so well known feature of bash is that it enters POSIX mode when called as "sh". This causes various subtle differences. Therefore, a #!/bin/sh script with /bin/sh -> bash might behave differently from a #!/bin/bash script.

Comment by Rasmus Johansson (Inactive) [ 2010-11-22 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
Please get this fixed in natty first (or at least alongside). The patch looks okay as a minimal workaround, so please get it uploaded.

Comment by Jakob Unterwurzacher (Inactive) [ 2010-11-22 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
Thing is, mysqld_safe isn't used anymore since Lucid as upstart has taken over (the file is still there though).

Comment by Kristian Nielsen [ 2010-11-23 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
I fixed this for mariadb by adding a patch to the .deb packaging that puts #!/bin/bash in the header of mysqld_safe.

Fix will be available from 5.1.52 and 5.2.4.

Comment by Kristian Nielsen [ 2011-02-15 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
Fixed in MariaDB 5.2.4 and 5.1.53

Comment by Rasmus Johansson (Inactive) [ 2012-09-20 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
I tested the testcase in the commit on Precise and there seem to no issue there
(probably fixed there).

Also, it is not the right approach to change #Unable to render embedded object: File (/bin/sh to #) not found./bin/bash since
former invokes POSIX compatibility mode and if dash has problems on any
platform, then that should be fixed rather than changing it in mysqld_safe or
#!/bin/sh needs to pointed elsewhere (or with update-alternatives).

Regarding the init scripts, I see that Percona Server is not packaged with
upstart script (hence vulnerable to this if on a platform with a buggy dash) as
mysql-server-55 does. I will open a separate issue to add that.

Comment by Rasmus Johansson (Inactive) [ 2012-09-20 ]

Re: [Hardy SRU] dash bug causes mysqld_safe to spin at 100% CPU
lp:1053183 is the issue for providing upstart scripts with percona-server.

Comment by Rasmus Johansson (Inactive) [ 2012-09-20 ]

Launchpad bug id: 675185

Generated at Thu Feb 08 06:47:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.