maria-discuss team mailing list archive
Mailing list archive
Re: mysqld-wait-ready -> Re: start mariadb randomly fails or answers with wrong response to systemd
Am 20.01.2014 16:37, schrieb Sergei Golubchik:
> Hi, Reindl!
> On Jan 20, Reindl Harald wrote:
>> "there are no time-consuming operations in-between" is not enough
>> in case of systemd and as-soon-as-possible parallel startup
> Okay, I suppose we can change that and start accepting connections
> before reporting "ready"...
that would be cool!
>> in fact systemd calls "ExecStart" and get the zero-return-value from
>> "/usr/libexec/mysqld" *before* the service really accepts connections
>> that's why "/usr/libexec/mysqld-wait-ready" was needed
> This is something I don't understand.
> As far as I remember, /usr/libexec/mysqld does not return until you
> shutdown the server. It doesn't daemonize itself, the caller is supposed
> to start it in the background.
i speak about "status=0/SUCCESS"
while a non-zero status would be a failure
[root@rh:~]$ systemctl status mysqld
mysqld.service - MariaDB Database
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: active (running) since Mo 2014-01-20 10:04:34 CET; 6h ago
Process: 740 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 739 (mysqld)
└─739 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid
--socket=/var/lib/mysql/mysql.sock --open-files-limit=750000 --basedir=/usr --user=mysql
> Perhaps - just guessing - systemd looks for a PIDFile and assumes that
> the service is ready as soon as the PIDFile is created?
no, the PID file would be not needed at all i guess if we would not need "ExecStartPost"
the problem is the timewindow between "ExecStart" and "ExecStartPost" and that
"code=exited, status=0/SUCCESS" happens before the daemon accepts connections and auth
while otherwise the PIDfile as well as "ExecStartPost" would not be needed at all
please take a look at
maybe the problem is *that* there is no option to let it daemonize itself with a CLI-switch
and/or support http://www.freedesktop.org/software/systemd/man/systemd.socket.html missing
with Type=forking the whole problem would went away without systemd.socket support needed
If set to forking, it is expected that the process configured with
ExecStart= will call fork() as part of its start-up. The parent process is expected to exit
when start-up is complete and all communication channels are set up
however, the current state is not perfect in case of systemd which acts really fine
as supervisor replacing "mysqld_safe" and super-simple service units
>> ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid
>> --socket=/var/lib/mysql/mysql.sock --open-files-limit=750000 --basedir=/usr --user=mysql
>> ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID
Description: OpenPGP digital signature