[squid-users] Survey on assertions: When the impossible happens

Amos Jeffries squid3 at treenet.co.nz
Tue Mar 1 00:19:34 UTC 2016


On 1/03/2016 6:46 a.m., Alex Rousskov wrote:
> On 02/29/2016 10:22 AM, Marcus Kool wrote:
>>
>>> * Choices.
>>>
>>> Overall, there are three options for handling an impossible situation:
>>>
>>> 1. Quit Squid process. This is what Squid does today in most cases.
>>>     When the impossible happens, you get a crash. Very predictable.
>>>     No malformed/corrupted/misleading HTTP messages (some are truncated).
>>>     No memory leaks.
>>>
>>> 2. Quit the current processing sequence but keep Squid process running,
>>>     assuming that [most] other processing sequences are not affected.
>>>     [If you are familiar with programming, this is done by throwing
>>>     exceptions instead of asserting and catching those exceptions at
>>>     "processing sequence" boundaries].
>>>
>>> 3. Keep executing the current processing sequence, assuming that the
>>>     assertion was wrong or unimportant. This is what you might be
>>>     suggesting above. When the impossible happens, you may get a crash,
>>>     memory leaks, malformed/corrupted/misleading HTTP messages, or normal
>>>     behavior, depending on the assertion and traffic.
>>>
>>> IMO, we should make #2 the default, but make the choice between all
>>> three options configurable by the admin (without recompiling Squid).
> 
> 
>> Let me suggest #4 :
>>
>> immediately execute an external program that calls gdb or any other
>> debugger
>> which produces a stack trace of all squid processes and then do #1 or #2.
> 
> This is not really #4. It is an enhancement for any of the three
> options. IIRC, Squid even supported gdb stack tracing natively on some
> platforms (but a script would arguably be better, except for busy
> proxies that cannot be blocked for 2-4 seconds it takes to run that script).
> 


This already exists. Squid does it *right now*.

You never received a "The Squid Cache (version %s) died." email ?


When mail [1] is working on the proxy Squid will use it to send an email
to the configured administrator email address [2], root@ address for the
proxies private hostname [3], or root@ address for the proxies public
hostname [4] - in that order or preference.
 - Of course, far too many people dont use FQDN for those config settings...


[1] http://www.squid-cache.org/Doc/config/mail_program/
[2] http://www.squid-cache.org/Doc/config/mail_from/
[3] http://www.squid-cache.org/Doc/config/unique_hostname/
[4] http://www.squid-cache.org/Doc/config/visible_hostname/


> 
>> The stack dumps will be save in an assertion failure log file which admins
>> can send to Squid developers.
>>


If Squid is also built with --enable-stacktraces a stack trace will be
recorded in cache.log after FATAL messages.
- Of course. Speed at any cost "needs" prohibit doing anything that
might slow down the Squid restart process. So that gets disabled.


Amos



More information about the squid-users mailing list