[squid-dev] Moved PID file management from Coordinator to Master

Tsantilas Christos chtsanti at users.sourceforge.net
Sun Jan 11 17:02:07 UTC 2015


Hi all,
  this patch moves pid file managment from coordinator process to master 
process.

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.

Please for more informations read the patch preamble.

This is a Measurement Factory project


Some extra notes/ideas
--------------------------

1) Multiple shutdown signals received by squid

  In current squid when coordinator received a shutdown signal, then 
replaced shutdown signal handlers with the default handlers. This is has 
as result when a second shutdown signal received then the coordinator 
process died immediately, without forwarding shutdown signal to kids. 
The shutdown of the other kids are finished as normal.

   This patch when master process receives a shutdown signal forward it 
to kids and master process is ready to receive a second shutdown signal. 
When a second shutdown signal received to master and this forwarded to 
kids then the kids died immediately.


2) The system admin shows a blocked kid (infinity loop or not 
responding). He kill with the hand.

   Current squid does not restart the kids killed by a TERM or KILL 
signal (squid considers it as normal kid shutdown).
This patch does not change this behaviour. The admin is still able to 
kill with a "kill -11" and in this case the kid will restarted.

My opinion is that squid should restart kids in these cases. Should not 
restart a kid only when a shutdown requested from system admin, or when 
the kids dying very fast (hopeless()==true ).

Regards,
    Christos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move-PID-file-management-to-Master-t6.patch
Type: text/x-patch
Size: 35594 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150111/40b1d3e2/attachment-0001.bin>


More information about the squid-dev mailing list