Mailing List Archive

varnishncsa ignoring SIGHUP?
Hi,

I'm suspecting that varnishncsa (from 1.0.3) doesn't actually listen
to a SIGHUP - I'm unable to make it re-open its logfile.

To work around this I'm currently logging to a FIFO and using another
tool (flog) to pick up and rotate the logs, but I thought it was
worth mentioning.

FYI this is on FreeBSD 6.2. Not sure if it has something to do with
the way I'm starting it or a bug in varnishncsa; I hacked together an
rc script which, after I discovered this, does what I describe above.
If anyone has an interest in the script let me know.

/Eirik
varnishncsa ignoring SIGHUP? [ In reply to ]
Eirik ?verby <ltning at anduin.net> writes:
> I'm suspecting that varnishncsa (from 1.0.3) doesn't actually listen
> to a SIGHUP - I'm unable to make it re-open its logfile.

Assuming that you didn't do something silly like redirect stdout instead
of using -w, I suspect this may be an effect of aggressive optimization
by the compiler. Try the following patch:

Index: bin/varnishncsa/varnishncsa.c
===================================================================
--- bin/varnishncsa/varnishncsa.c (revision 1444)
+++ bin/varnishncsa/varnishncsa.c (working copy)
@@ -347,7 +347,7 @@

/*--------------------------------------------------------------------*/

-static sig_atomic_t reopen;
+static volatile sig_atomic_t reopen;

static void
sighup(int sig)

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no