]> git.ipfire.org Git - thirdparty/squid.git/commit - src/tools.cc
Moved PID file management from Coordinator to Master.
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 21 Jan 2015 12:08:35 +0000 (14:08 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 21 Jan 2015 12:08:35 +0000 (14:08 +0200)
commitdbf55289570fd9d516da2324993e4bceea73eeaa
tree7b9e15fc40fa934ff550b60150190be4574082d8
parent6b634dc323fdfd75bac737a38faeb171fce705df
Moved PID file management from Coordinator to Master.

This move is the first step necessary to avoid the following race condition
among PID file deletion and shared segment creation/destruction in SMP Squid:

  O1) The old Squid Coordinator removes its PID file and quits.
  N1) The system script notices Coordinator death and starts the new Squid.
  N2) Shared segments are created by the new Master process.
  O2) Shared segments are removed by the old Master process.
  N3) New worker/disker processes fail due to missing segments.

TODO: The second step (not a part of this change) is to delete shared memory
segments before PID file is deleted (all in the Master process after this
change).

Now the Master process receives signals and is responsible for forwarding them
to the kids.

The kids does not install default signal handler for shudown signals (SIGINT,
SIGTERM) after a signal received. If a second shutdown signal is received then
squid imediatelly terminates the event loop and exits.

When the "kill-parent-hack" is enabled the kids are sending the kill signal
to master process and master process forward it to other kids too.

Also a small regression added: The PID file can no longer be renamed using
hot reconfiguration. A full Squid restart is now required for that.

This is a Measurement Factory project.
src/ipc/Kid.cc
src/ipc/Kid.h
src/main.cc
src/tests/stub_tools.cc
src/tools.cc
src/tools.h