[PATCH] If a worker process crashes during shutdown, dump core and prevent restarts

From: Dmitry Kurochkin <dmitry.kurochkin_at_measurement-factory.com>
Date: Sat, 20 Nov 2010 00:45:21 +0300

If a worker process crashes during shutdown, dump core and prevent restarts.

Before the change, if a worker process crashes during shutdown, death()
handler would exit with code 1, and master process would restart the
worker. Now workers send SIGUSR1 to master when shutting down. When
master process gets the SIGUSR1 signal, it stops restarting workers.

SIGUSR1 is already used for log rotation, but it is fine to use SIGUSR1
for master process shutdown notifications because master is never
responsible for both log rotation and kid restarts.

Terminate with abort(3) instead of exit(3) to leave a core dump if Squid
worker crashes during shutdown.

Also the patch fixes potential infinite loop in master process. Master
finished only when all kids exited with success, or all kids are
hopeless, or all kids were killed by a signal. But in cases like when
part of kids are hopeless and other were killed, master process would
not exit. After the change master exits when there are no running kids
and no kids should be restarted.

Add syslog notice if kid becomes hopeless.

Regards,
  Dmitry

Received on Fri Nov 19 2010 - 21:45:41 MST

This archive was generated by hypermail 2.2.0 : Wed Nov 24 2010 - 12:00:05 MST