[squid-users] Bug: 'squid -k interrupt' quits on config file error, fails to kill process

Alex Rousskov rousskov at measurement-factory.com
Mon Mar 14 13:53:39 UTC 2022


On 3/13/22 19:49, Dave Blanchard wrote:
> On Sun, 13 Mar 2022 18:38:05 -0400 Alex Rousskov wrote:
>> kill -9 will not kill SMP Squid workers and other kid
>> processes. To a large degree, Squid will just keep running as if nothing
>> happened -- that signal cannot be caught and processed specially by the
>> receiving Squid process. Do not use "kill -9 `cat pidfile`" if you are
>> using SMP Squids!


> It turns out double kill with a SIGTERM, besides being rather
> inelegant, doesn't do the job either. It takes its sweet ass time--a
> few seconds--to exit.

If you do not want Squid to wait for shutdown_lifetime to let some 
pending transactions finish, then use "squid -k interrupt" (or SIGINT if 
you want to work around unsupported invalid configuration files). That 
shutdown procedure does not have a delay.


> Who said I wanted the proxy, busy or not, to keep running and finish
> what it's doing? The entire point is for it to stop IMMEDIATELY!
> ESPECIALLY if it's currently busy!

Squid supports a variety of shutdown procedures that accommodate many 
realistic use cases. The better you specify what _you_ want, the better 
we can help you achieve those results. Your original email did not say 
that you wanted Squid to stop IMMEDIATELY, and your followup email was 
concerned with "any harm", so Amos suggested a graceful shutdown mode, 
probably (very reasonably IMO!) assuming that you want to minimize harm.


> So is there a signal that can be sent which is the exact equivalent
> of squid -k interrupt?

Yes, "squid -k interrupt" uses SIGINT.


> Why, oh why, does the config file have to be 100% valid

I believe I have already answered that loaded question. If something is 
not clear in my answer, please feel free to ask followup questions, but 
we should not go in circles.


> What is actual use of the pidfile to the end user

I think there are two ways to answer this question:

* None: The PID file is not meant to be used by the end user. You may 
use it at your own risk (e.g., if you want to work around unsupported 
invalid configuration files), but such use is just an unsupported hack.

* The actual use of the PID file is to send a (supported) signal to the 
running Squid instance without executing the Squid binary, with all the 
conveniences and problems such executions may bring.

I am not sure what the official Squid Project position is regarding end 
user use of the PID file. Such an official position may not exist (yet), 
but I suspect it is currently closer to the first bullet because we do 
not disclose/document which signals are used by various "squid -k" commands.


HTH,

Alex.


More information about the squid-users mailing list