[systemd-devel] race conditions after SIGTERM

Reindl Harald h.reindl at thelounge.net
Thu Aug 14 11:04:23 PDT 2014

Am 14.08.2014 um 19:51 schrieb Lennart Poettering:
> On Thu, 14.08.14 21:38, Andrei Borzenkov (arvidjaar at gmail.com) wrote:
>>> Which is what we do. Except when you specify ExecStop= which basically
>>> tells systemd that you want to do it instead. So there you go!
>> Those daemons I have seen are terminated after receiving signal/command
>> to do it. Those sysvinit scripts that "synchronously" terminated
>> services did it by implementing wait for daemon process to exit. What
>> is worse, the only way to do it is busy looping as they cannot normally
>> receive notification about process exit.
> Well, if they don't have such a protocol, then they can use systemd's
> default logic for this, and just tweak the parameters. KillMode=,
> KillSignal=, TimeoutStopSec= are all ways how you can control how
> exactly systemd should terminate your service.
>> Compare this with "send daemon command - signal or whatever - and wait
>> until it exits". This needs to be implemented just once in PID 1 - and
>> PID 1 already does exactly this most of the time anyway. Why is this
>> the wrong thing to do? You never explained this when you rejected my
>> patch.
> Hmm, this is what we do. By specifiying ExecStop= you turn that off
> however can plug in your own logic. If you don't have any better logic,
> then simply don't plug anything in, that's what we recommend anyway.
> Again: systemd does what you want it to do by default, anyway. By
> specifiying ExecStop= you however turn this off, and have to do it on
> your own!

Uhm - i did not have *any* ExecStop / EexecStopPost until it came
to compromised mysqld datafiles - other than the Fedora packages
i just used

ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/run/mysqld/mysqld.pid

after problems i added "ExecStartPost=/usr/bin/sleep 1" which avoided
the problems most of the time but implicates a useless second at

*currently* i added "ExecStop=/usr/bin/kill -15 $MAINPID" and upgraded
to Fedora 20 in the hope systemd-208 does that better than systemd-204
on Fedora 19

*normally* i would expect

ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/run/mysqld/mysqld.pid

as the only start / stop configuration and be sure after "systemctl stop mysqld"
returns the daemon process is really away and had written what he needs and
starting rsync the datadir is safe

that is not the case, hence the thread and bugreport for systemd on F19

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140814/37131773/attachment.sig>

More information about the systemd-devel mailing list