Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 391791 - dev-db/mysql-5.1.59 - "/var/run/mysqld/mysqld.pid" is still present and the process is running.
Summary: dev-db/mysql-5.1.59 - "/var/run/mysqld/mysqld.pid" is still present and the p...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-24 17:27 UTC by DaggyStyle
Modified: 2012-02-02 03:04 UTC (History)
1 user (show)

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


Attachments
mysqld.err (mysqld.err,19.67 KB, text/plain)
2011-11-30 16:23 UTC, DaggyStyle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description DaggyStyle 2011-11-24 17:27:24 UTC
for some reason mysql doesn't starts at boot, when I run it from cli for the first time, I get this:
mysql                     | * Caching service dependencies ...                                                            [ ok ]
mysql                     | * Starting  ...
mysql                     | * "/var/run/mysqld/mysqld.pid" is still present and the process is running.
mysql                     | * Please stop it "kill 2498" maybe ?                                                          [ !! ]
mysql                     | * ERROR: mysql failed to start

running it the second time boots it ok

Reproducible: Always
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-11-25 22:06:17 UTC
1. at boot, what else is on that pid?
2. why did the pid file exist if you shut down cleanly?
Comment 2 DaggyStyle 2011-11-26 06:43:02 UTC
(In reply to comment #1)
> 1. at boot, what else is on that pid?
pid file you mean?
> 2. why did the pid file exist if you shut down cleanly?
that is the question... in what stage should the file be deleted?
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-11-26 06:50:46 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > 1. at boot, what else is on that pid?
> pid file you mean?
No.

If you do a hard shutdown, and the pidfile does not get removed, and on the next start, the pidfile contains a low numbered pid, there is a chance that it conflicts with some system process from boot.

> > 2. why did the pid file exist if you shut down cleanly?
> that is the question... in what stage should the file be deleted?
the stop phase of the mysql init script removes the pidfile (mysqld itself actually removes it).
Comment 4 DaggyStyle 2011-11-26 17:04:46 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > 1. at boot, what else is on that pid?
> > pid file you mean?
> No.
> 
> If you do a hard shutdown, and the pidfile does not get removed, and on the
> next start, the pidfile contains a low numbered pid, there is a chance that it
> conflicts with some system process from boot.
> 
> > > 2. why did the pid file exist if you shut down cleanly?
> > that is the question... in what stage should the file be deleted?
> the stop phase of the mysql init script removes the pidfile (mysqld itself
> actually removes it).

I do a normal shutdown, from what I can see, mysql shuts down ok, I'll double check to verify it.
Comment 5 DaggyStyle 2011-11-29 17:48:29 UTC
double checked:
dagg@NCC-5001-D ~ $ rc-status | grep mysql
 mysql                                                             [  stopped  ]
dagg@NCC-5001-D ~ $ ll /var/run/mysqld
total 5
srwxrwxrwx  1 mysql mysql   0 Nov 29  2011 mysqld.sock
-rw-rw----  1 mysql mysql   5 Nov 29  2011 mysqld.pid
drwxr-xr-x 18 root  root  744 Nov 29  2011 ..
drwxr-xr-x  2 mysql mysql 112 Nov 29  2011 .

right after boot but I see what can be the issue, /var/log/messages shows this:
Nov 29 20:48:33 NCC-5001-D /etc/init.d/mysql[2730]: MySQL NOT started (0)
Nov 29 20:48:33 NCC-5001-D /etc/init.d/mysql[2131]: ERROR: mysql failed to start

it seems that it fails to start and the content of /var/run/mysqld is still there, how can I debug this?
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-11-29 18:26:23 UTC
1.
Is there anything in the mysql log files?
/var/log/mysql/*

2.
Follow this process for me, and report results:
#1 - ensure mysqld is not running
#2 - rm /var/run/mysql*/mysql*pid
#3 - /etc/init.d/mysql start
Comment 7 DaggyStyle 2011-11-30 06:14:24 UTC
(In reply to comment #6)
> 1.
> Is there anything in the mysql log files?
> /var/log/mysql/*
> 
> 2.
> Follow this process for me, and report results:
> #1 - ensure mysqld is not running
> #2 - rm /var/run/mysql*/mysql*pid
> #3 - /etc/init.d/mysql start

using rc-config start mysql in #3 instead causes the second flow to work.
I remember I've done it but just to make sure I'll try it at home later today.
Comment 8 DaggyStyle 2011-11-30 16:23:58 UTC
Created attachment 294353 [details]
mysqld.err

(In reply to comment #6)
> 1.
> Is there anything in the mysql log files?
> /var/log/mysql/*
> 
dagg@NCC-5001-D ~ $ ll /var/log/mysql/*
-rw-rw---- 1 mysql mysql     0 Oct  2 11:22 /var/log/mysql/mysql.log
-rw-rw---- 1 mysql mysql     0 Oct  2 11:22 /var/log/mysql/mysql.err
-rw-rw---- 1 mysql mysql 20146 Nov 30  2011 /var/log/mysql/mysqld.err

content of /var/log/mysql/mysqld.err attached
Comment 9 DaggyStyle 2011-11-30 16:25:13 UTC
(In reply to comment #6)
> 2.
> Follow this process for me, and report results:
> #1 - ensure mysqld is not running
> #2 - rm /var/run/mysql*/mysql*pid
> #3 - /etc/init.d/mysql start

dagg@NCC-5001-D ~ $ rc-status | grep mysql
 mysql                                                             [  stopped  ]
dagg@NCC-5001-D ~ $ Su rm /var/run/mysql*/mysql*pid
Password: 
dagg@NCC-5001-D ~ $ Su /etc/init.d/mysql start
Password: 
mysql                     | * Starting  ...
mysql                     | * Strange, the socket file already exist in "/var/run/mysqld/mysqld.sock"
mysql                     | * it will be removed now and re-created by the MySQL server
mysql                     | * BUT please make your checks.
mysql                     | * Starting  (/etc/mysql/my.cnf)
mysql                     | * MySQL NOT started (0)                                                                       [ !! ]
mysql                     | * ERROR: mysql failed to start
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-11-30 19:58:20 UTC
did you check with ps that no mysqld was actually running? rc-status just tells you the state of the init.d, which isn't entirely accurate to stuck processes.
Comment 11 DaggyStyle 2011-12-04 06:16:37 UTC
(In reply to comment #10)
> did you check with ps that no mysqld was actually running? rc-status just tells
> you the state of the init.d, which isn't entirely accurate to stuck processes.

dagg@NCC-5001-D ~ $ ps -ef | grep sql
mysql     2662     1  0 08:01 ?        00:00:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock
dagg      3643  3541  0 08:14 pts/0    00:00:00 grep --colour=auto sql

it seems that the service is up

so it is a openrc issue, right?
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-12-04 06:44:15 UTC
do you have a large innodb setup that takes a long time to check?

look in
/etc/conf.d/mysql
and adjust the STARTUP_TIMEOUT and STOP_TIMEOUT values maybe.
Comment 13 DaggyStyle 2011-12-04 13:24:23 UTC
(In reply to comment #12)
> do you have a large innodb setup that takes a long time to check?
> 
I don't think so, I have like 3 virtually empty dbs

> look in
> /etc/conf.d/mysql
> and adjust the STARTUP_TIMEOUT and STOP_TIMEOUT values maybe.
that would not explain why when I try to restart it, the process works ok.
Comment 14 DaggyStyle 2011-12-25 16:44:57 UTC
is there any fix for this?
Comment 15 Brian Evans (RETIRED) gentoo-dev 2012-01-16 22:00:59 UTC
I did see this covered so...
Which version of mysql-init-scripts are installed?

I've had frequent issues with the v1 series failing to report OK at times.
The new mysql-init-scripts-2.0_pre1-r2, currently requested stable, seem to work a lot better.
Comment 16 Brian Evans (RETIRED) gentoo-dev 2012-01-16 22:03:47 UTC
Bad typing..
(In reply to comment #15)
> I did see this covered so...
I *didn't*
> Which version of mysql-init-scripts are installed?
> 
> I've had frequent issues with the v1 series failing to report OK at times.
> The new mysql-init-scripts-2.0_pre1-r2, currently requested stable, seem to
requested stable in bug 397925

Sorry for the noise.
Comment 17 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-02-02 03:04:17 UTC
Should work fine with new scripts which are now stable on most arches