Bug in varnishlog (-u and -o flags)

Yvan Taviaud yvan.taviaud at gmail.com
Sun Mar 21 09:19:22 CET 2010


Hello,

I think I've found a bug after struggling for many hours with STDIN 
buffering. The fact is that I'm not a C developer, hence the time to 
understand the issue was in varnishlog took me hours :-)

So, I was trying to use it with the following command:

varnishlog -u -c -o TxStatus '^503$' > /tmp/varnish.test

(in order to match all 503 errors)

But this wasn't working good, as the output sent to the log file was 
buffered, even if the -u flag was used. I think the issue is here:
(bin/varnishlog.c, around line 388, release is 2.0.6)

        if (o_flag)
                do_order(vd, argc - optind, argv + optind);

       if (u_flag)
                setbuf(stdout, NULL);

So, as the do_order() is an infinite loop, the u_flag test is never 
seen. If I reverse both tests, everything seems to work as expected. Is 
there any issue inverting those tests?

Also I'd like to know if there's a reason to disable -w when -o is used? 
It can be really useful, for example in this case I'm trying to track 
503 errors, so logging to file with grouped requests would be great.

Best regards,
Yvan.




More information about the varnish-bugs mailing list