BUG/MINOR: systemd: ensure we don't miss signals
authorWilly Tarreau <w@1wt.eu>
Sat, 27 Feb 2016 06:58:50 +0000 (07:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 27 Feb 2016 07:28:42 +0000 (08:28 +0100)
commit1ab5e8642a3537006db8eeed4a3b1bdca2458b33
tree34d4382fa82d6650fccd3e9d63e93bc45f410c49
parent320ec2a7454a84a6bb318a8a132d0300b712937f
BUG/MINOR: systemd: ensure we don't miss signals

There's a race condition in the systemd wrapper. People who restart it
too fast report old processes remaining there. Here if the signal is
caught before entering the "while" loop we block indefinitely on the
wait() call. Let's check the caught signal before calling wait(). It
doesn't completely close the race, a window still exists between the
test of the flag and the call to wait(), but it's much smaller. A
safer solution could involve pselect() to wait for the signal
delivery.
src/haproxy-systemd-wrapper.c