Re: [squid-users] A way/hack to force squid to die?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 10 Jun 2011 19:00:45 +1200

On 10/06/11 08:32, david_at_lang.hm wrote:
> On Thu, 9 Jun 2011, Helmut Hullen wrote:
>
>> Hallo, Tom,
>>
>> Du meintest am 09.06.11:
>>
>>
>>> I need to verify, if I get a mail when squid dies (I put a correct
>>> mailaddress in cache_mgr-directive). Is there a way/hack to force
>>> squid to die?
>>
>> Yes - this daemon is started from a script p.e. with the command
>>
>> /etc/init.d/squid start
>>
>> (the command depends on your distribution).
>>
>> And stopping squid is nearly the same command.
>>
>> Brute force (under a linux distribution):
>>
>> killall squid
>>
>> (if you are curious: repeat the command)
>
> actually, you do need to repeat the command. Squid doesn't stop
> immediatly when it gets the standard kill signal (15), it does some sort
> of graceful shutdown that can take a significant amount of time to
> actually take place.
>
> I ran into this when trying to upgrade squid, if I do "killall squid;
> /etc/init.d/squid start" I frequently get a message from the start that
> squid is still running, but then a little while later squid will stop
> (and since the start command failed, an outage occures)
>
> I've also found that the number of killall cycles you need to go through
> varies depending on the squid version and config, with versions other
> than 3.2 with more than one worker I need to do two killall commands to
> get squid to stop, with 3.2 and more than one worker I find I need three.
>
> what I do is to do killall squid in a loop until the killall command
> returns an error that there is no process to kill.

Whereas what you should do to _abort_ Squid is simply a:
   squid -k kill

I do hope you realize that killing Squid with "-k kill", the kill or
killall commands causes you worse problems in the long term.

   The slow graceful shutdown is trading a small amount of time on
shutdown for about 10x to 20x the same time when re-starting. Squid
forced to scan the entire cache disk object by object if the swap.state
is not written out on shutdown.

  It is also trading some delay period waiting for existing client
connections to complete, preventing client browsers (or downstream
caches!) receiving corrupted content. Or just as bad, allowing Squid
time to close the open disk files, preventing local cache corruption.

NP: we are slowly auditing the things which can be done immediately
without the wait (like dropping idle connections, helpers etc fast).
Assistance welcome pointing them out for fixing.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.12
   Beta testers wanted for 3.2.0.8 and 3.1.12.2
Received on Fri Jun 10 2011 - 07:02:50 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 10 2011 - 12:00:01 MDT