[squid-dev] [PATCH] Do not die silently when dying early

Alex Rousskov rousskov at measurement-factory.com
Fri May 19 22:25:30 UTC 2017


Hello,

    The attached patch allows Squid to report various problems (e.g.,
mishandled exceptions) that may occur very early in Squid lifetime,
before proper logging is configured by the first _db_init() call.

To enable such early reporting, we started with a trivial debug.cc change:

  -FILE *debug_log = NULL;
  +FILE *debug_log = stderr;

... but then realized that debug_log may not be assigned early enough!
The resulting changes ensure that we can log (to stderr if necessary) as
soon as stderr itself is initialized. They also polish related logging
code, including localization of stderr checks and elimination of
double-closure during log rotation on Windows.

These reporting changes do not bypass or eliminate any failures.

This patch is independent from the "Do not die silently when dying via
std::terminate()" patch posted a few days ago, but, in combination, the
two patches fix reporting of early std::terminate() deaths.


Cheers,

Alex.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SQUID300-silent-early-death-t4.patch
Type: text/x-diff
Size: 16947 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20170519/e7eb0465/attachment-0001.patch>


More information about the squid-dev mailing list