Re: mysqld_safe seems unsafe

Some settings such as ulimit -n (open-files-limit) cannot be done from inside the daemon. Most other daemons fork themselves so the same mechanism for restarting is built in anyway. A signal 11 is always a bug, not normal or acceptable. So I trust you reported the backtraces from the errorlog? Regards, Arjen. -------- Original message -------- From: Russell Coker <russell@coker.com.au> Date: 08/11/2013 17:07 (GMT+10:00) To: luv-main@luv.asn.au Subject: mysqld_safe seems unsafe It's always a sign of low code quality when a daemon has a wrapper script to restart it when it crashes. Squid used to have such a script but for many years has been considered to be reliable enough not to need it. MySQL seems to be the only commonly used daemon with such a script. I had been wondering if the script was even needed, I would have hoped that mysqld was reliable many years ago. But I checked the logs of a RHEL4 system I run and found 19 log messages about mysqld getting signal 11 since 2006 of which the last one was 4 days ago. One problem with such scripts seems to be the issue of reliably shutting down the server. I have a ZFS system that doesn't always mount the filesystems on boot so I use /etc/rc.local to restart mysqld. That usually works apart from the time when I ended up with two copies of mysqld running at once. However mysqld uses file locking and it seems that you don't get data loss when you have two copies of it running at the same time (try not to test this theory on production networks). While it was handy that mysqld was restarted 19 times, it wasn't good that I was unaware of the problems. Is that script being used in the MySQL successors such as Drizzle? -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/ _______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

On Fri, 8 Nov 2013, Arjen Lentz <arjen@lentz.com.au> wrote:
Some settings such as ulimit -n (open-files-limit) cannot be done from inside the daemon.
Sure they can, setrlimit(RLIMIT_NOFILE, ... Why do you want to set an open files limit anyway? If a mysqld gets in a state where it opens more files than expected is having the open/pipe/accept call fail going to be the best thing for the system?
Most other daemons fork themselves so the same mechanism for restarting is built in anyway.
No most daemons fork themselves to detach from the controlling terminal, daemon(3) is usually the best way of doing this.
A signal 11 is always a bug, not normal or acceptable. So I trust you reported the backtraces from the errorlog?
I doubt that for a RHEL 4 system which hasn't had all the available updates applied there is anyone who is interested in receiving such bug reports. I'll just make it more of a priority to upgrade the system to a newer distribution. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

On 11 November 2013 10:31, Russell Coker <russell@coker.com.au> wrote:
On Fri, 8 Nov 2013, Arjen Lentz <arjen@lentz.com.au> wrote:
Some settings such as ulimit -n (open-files-limit) cannot be done from inside the daemon.
Sure they can, setrlimit(RLIMIT_NOFILE, ...
Why do you want to set an open files limit anyway? If a mysqld gets in a state where it opens more files than expected is having the open/pipe/accept call fail going to be the best thing for the system?
I suspect they were trying to *increase* the default, rather than lower it?

Hi Toby, On 11/11/13 10:37, Toby Corkindale wrote:
On 11 November 2013 10:31, Russell Coker <russell@coker.com.au> wrote:
On Fri, 8 Nov 2013, Arjen Lentz <arjen@lentz.com.au> wrote:
Some settings such as ulimit -n (open-files-limit) cannot be done from inside the daemon.
Sure they can, setrlimit(RLIMIT_NOFILE, ...
Why do you want to set an open files limit anyway? If a mysqld gets in a state where it opens more files than expected is having the open/pipe/accept call fail going to be the best thing for the system?
I suspect they were trying to *increase* the default, rather than lower it?
Indeed - and the reason for this is that mysqld is single-process, multi-threaded. Other daemons that need to open lots of files tend to be multi-process, which makes it easy to open lots of files. Typically the default limit is 1024 which is not sufficient for most production systems. Regards, Arjen. -- Exec.Director @ Open Query (http://openquery.com) MariaDB/MySQL services Sane business strategy explorations at http://upstarta.com.au Personal blog at http://lentz.com.au/blog/
participants (3)
-
Arjen Lentz
-
Russell Coker
-
Toby Corkindale