Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24029 - mysql startup script fails to start mysql 4.0.13 immideatelly after stopping mysql.
Summary: mysql startup script fails to start mysql 4.0.13 immideatelly after stopping ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-06 21:46 UTC by Alex K
Modified: 2004-01-03 20:14 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex K 2003-07-06 21:46:51 UTC
If i stop mysql by running /etc/init.d/mysql stop, and immedeatelly start it 
with /etc/init.d/mysql, before all the mysql processes have existed, mysql will 
not start on this machine till the next reboot. this doesn't seem related to 
mysql, but to the init script - it doesn't wait until mysql exits. stopping 
mysql, waiting till all processes exist, and then starting it works around the 
problem.

Reproducible: Always
Steps to Reproduce:
1./etc/init.d/mysql stop;/etc/init.d/mysql start

Actual Results:  
mysql did not start.

Expected Results:  
stopped and started mysql

the machine is sparc e450, not that i think it's related
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-12 01:18:04 UTC
make sure you are using the latest mysql ebuild, as I cannot reproduce this on x86 hardware at all.
Comment 2 Alex K 2003-08-12 01:39:54 UTC
using latest ebuild :

emerald root # epm -qi mysql
Name        : mysql
Version     : 4.0.13
Release     : 3                                   Slot: 0
Install date: Sun Jun 22 20:25:32 2003      Build Host: sparc-unknown-linux-gnu
Group       : dev-db                           License: GPL-2
Size        : TBD
Packager    : robbat2
URL         : http://www.mysql.com/

Now, the same condition occurs if mysql dies (i can simulate this my "kill -9 (pid of safe-mysqld), and killall mysqld) - after this you cannot start mysql again still without reboot.

I could provide root access to the machine for debugging perposes of this problem - contact me directly by email.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-12 01:46:07 UTC
Please upgrade all the way to 4.0.14-r1 (In ~sparc and ~x86 presently).

following your instructions as:
killall -9 safe_mysqld
killall mysqld

then doing:
/etc/init.d/mysql zap
/etc/init.d/mysql start

it starts fine on 4.0.14-r1 for me.
Comment 4 Alex K 2003-08-12 02:34:21 UTC
Ok, now i get it. that i was missing was the zap option - after running it i can start the service. but on my machine /etc/init.d/mysql stop doesn't wait for mysql to shutdown, so when i run /etc/init.d/mysql start, it thinks that mysql is started successfully (when it actually haven't shutdown yet), instead of detecting that mysql is already running. this seems to me like some better detection on the start stop process are in order, unless one should be expected to run the zap command between service restarts. 

gentoo rc scripts can be confusing for a newcomer. 
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-12 15:07:19 UTC
Ah, I think I know the problem...
how many processors in your sparc ?

doing this command: "/etc/init.d/mysql stop ; /etc/init.d/mysql start"
runs both of them simultaneosly and lack of locking causes a few problems here...
Comment 6 Alex K 2003-08-13 03:17:22 UTC
I actually have 2 processors on that machine ;)
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-17 18:28:39 UTC
azarah:
it seems that start-stop-daemon doesn't have any locking against concurrent calls to it, as in Alex's case here where there are two instances of it running simultaously from what I can see.

Perhaps it should have some locking to prevent this?
If you agree, I'll try to put together a patch for it.
Comment 8 Eric Pretorious 2003-09-02 17:44:34 UTC
`/etc/init.d/mysql stop` doesn't stop mysql. (mysql-4.0.13-r3 on PPC)

Checking /usr/bin/mysql_safe (the --exec value passed to the start-stop-daemon) reveals that signals '', 1, 2, 3, and 15 are caught to prevent mysql from being kill'ed.

Shouldn't this behavior be configurable through the use of a configuration script? e.g., /etc/conf.d/mysql

How is one supposed to stop mysqld? Shouldn't `/etc/init.d/msyql stop` accomplish this?
Comment 9 Josh Grebe (RETIRED) gentoo-dev 2003-12-31 12:23:41 UTC
Is this fixed in the recent mysql builds? I am not able to reproduce with
/etc/init.d/mysql stop;/etc/init.d/mysql start
it works as would be expected, on a quad ultrasparc box.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-01-03 20:14:19 UTC
afaik this got fixed upstream for 4.0.16 or .17, so closing this bug.