[squid-dev] [RFC] on_crash

Alex Rousskov rousskov at measurement-factory.com
Wed Dec 9 16:51:20 UTC 2015


Hello,

    The attached patch modifies Squid to run /tmp/squid-on-fatal.sh on
fatal errors. A sample script is also attached. I needed this trick to
triage a complicated bug related to Squid shared memory usage.

In general, running such a script helps record the environment state
_before_ Squid exits, which is important when the problem is related to
Squid resource usage that often becomes invisible after the Squid
process is gone: connections, FDs, shared memory segments, etc.

The patch needs more work to make this behavior and the script name
squid.conf-configurable. We should also pass Squid PID and Squid process
"role" to the script as parameters so that the script does not have to
guess them.


Do you want this feature in Squid?

If yes, which squid.conf directive name do you think works the best?
Here are some options to consider:

on_crash ...
on_fatal_exit ..
on_bad_exit ...
on_unexpected_exit ...
on_exit <success|failure> ...

The directive parameter could be

  program=...
  handler=...

which would allow us to easily add more exit-handling options later if
needed (e.g., free_all_memory, keep_shared_memory, etc.).


Please note that Squid already does something similar on startup. See
squid_start_script in main.cc. That hack should be made configurable
too, of course (on_start, on_launch, etc.).


Thank you,

Alex.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: on-fatal-t4.patch
Type: text/x-diff
Size: 2916 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20151209/4ef52aa1/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: squid-on-fatal.sh
Type: application/x-sh
Size: 1490 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20151209/4ef52aa1/attachment.sh>


More information about the squid-dev mailing list