[squid-dev] [PATCH] avoid clobbering errno in debugs()

Kinkie gkinkie at gmail.com
Sun Jul 12 12:49:53 UTC 2015


On Sun, Jul 12, 2015 at 10:20 AM, Amos Jeffries <squid3 at treenet.co.nz>
wrote:

> On 12/07/2015 7:03 p.m., Kinkie wrote:
> > I tried it. Unfortunately it fails for those cases of debugs() which do
> not
> > use xstrerror, e.g.
> >
> > ../../src/esi/Element.h: In member function 'virtual bool
> > ESIElement::addElement(ESIElement::Pointer)':
> > ../../src/esi/Element.h:64:74: error: unused variable '_squid_errno'
> > [-Werror=unused-variable]
> >          debugs(86,5, "ESIElement::addElement: Failed for " << this);
> >
> > :(
> > I believe putting the burden of saving state to the caller is way too
> > intrusive: a simple count places the number of xstrerror calls at about
> 260.
> > So we're back to square one, the -v2 patch. Do you see any other options?
> >
>
> No sorry. But I do know that we also have to deal with CONTENT cotaining
> nested functions etc. That means nested debugs() calls...
>

Yes, but we do not really need to be reentrant: the problems you have
identified are all in debugLogTime, which doesn't need to be reentrant (and
right now it is not, as it uses a static buffer).


> At debugs level 9 this is a big problem, particularly for things like
> debugs in SBuf/String/MemBuf/MemAllocator methods that get triggered by
> any object producing debug output for display.


Yes.
At the same time, while the proposed patch may not be the final fix to the
problem, I believe it helps a little bit in improving things. Especially
since no alternate path seems viable.

-- 
    Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150712/5c33ea7b/attachment.html>


More information about the squid-dev mailing list