daemon: restart child process if it died before signaling its readiness
authorAnsis Atteka <aatteka@nicira.com>
Tue, 8 Jul 2014 00:11:39 +0000 (17:11 -0700)
committerAnsis Atteka <aatteka@nicira.com>
Thu, 10 Jul 2014 17:29:45 +0000 (10:29 -0700)
commitb925336a36e6041b006d59ef78e91c5c13be62ba
tree66f836ff4a46eaae00d0856a6cb1d77c52319827
parent4537a423fb4c607fcbef53ab830e86250ba8748c
daemon: restart child process if it died before signaling its readiness

The child process (the one being monitored) could die before it was able
to call fork_notify_startup() function.  If such situation arises, then
parent process (the one monitoring child process) would also terminate
with a fatal log message:

...|EMER|fork child died before signaling startup (killed (...))

This patch changes that behavior by always restarting child process
if it was able to start up at least once in the past.  However, if
child was not able to start up even once, then the monitor process
would still terminate, because that would most likely indicate a
persistent programming or system error.

To reproduce use following script:

while : ; do kill -SIGSEGV `cat /var/run/openvswitch/ovs-vswitchd.pid`; done

Signed-Off-By: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
VMware-BZ: 1273550
lib/daemon-unix.c