Re: squid-3.HEAD IPAddress leak

From: Amos Jeffries <squid3@dont-contact.us>
Date: Fri, 8 Feb 2008 10:24:30 +1300 (NZDT)

>
> On Thu, 2008-02-07 at 12:21 +0900, Adrian Chadd wrote:
>>
>> Well, I haven't removed the temporary malloc/free pair, whatever its
>> called;
>> I've just removed Amos' workaround in src/comm.cc so it doesn't leak
>> on my
>> system whilst I profile.
>>
>> Still, this is one of those "death of a thousand cuts" method of
>> killing performance..
>
> Right, I haven't seen the commit; care to mail the diff?
>

Here you go.
"
--- src/comm.cc 2008-01-19 20:50:42.000000000 +1300
+++ src/comm.cc-2 2008-02-08 09:56:11.000000000 +1300
@@ -1381,7 +1381,7 @@

     }

-#ifdef _SQUID_LINUX_
+#ifdef 0 // _SQUID_LINUX_
     /* 2007-11-27:
      * Linux Debian replaces our allocated AI pointer with garbage when
      * connect() fails. This leads to segmentation faults deallocating
"

In reply to your last few emails Adrian.

re: can we join up on IRC?

  I may not be able to for the next few days, too much else on.

re: Why are you trying to allocate the structure on invocation of
GetAddrInfo() ?

  The design was to follow the well-known structure of the kernel call
getaddrinfo(), which fills kernel-managed memory in a thread-safe way
down a dynamic structure. The addrinfo structs are too nasty to use
naked for anything like the amount of comm usage squid has. They are not
an object per-se, but the root of a pointer tree to various types of
node, which depend on the flags for their memory sizes.
  We could make a variant of the call which takes an addrinfo object and
sets it up to point at the IPAddress internals correctly. BUT the bug we
are looking at would then cause the IPAddress to become garbage, maybe
have the kernel free'ing stack memory, etc.

re: Argh, this temporary malloc/free pair is peppered throughout the
codebase! Grr.

 You already know there are naked comm calls everywhere. :-( Most of them
calls addrinfo was desgined for use in.

re: I've removed that hack, and things work fine for me. Ubuntu 7.01 here,
x86_64.

 Yes, I found no problem on ubuntu also. I simply could not (after very
little searching) find a #if test that would only work for Debian.

Amos
Received on Thu Feb 07 2008 - 14:24:34 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST