Re: NTLM memory leaks

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 15 Feb 2002 01:15:37 +0100

On Thursday 14 February 2002 02.23, Robert Collins wrote:

> > The second I am not entirely sure about. Think the strdup should
> > be taken out of there, but you know the auth code better. The
> > following seems to work here:
>
> I'll review tonight.

Got any conclusion?

There also seems to be other memory related issues. Now that I have a
Squid where the NTLM scheme is enabled (not only compiled) it now
always segfaults on shutdown. Seems to be accessing a memory pool
after the pool has been destructed.

(gdb) setenv LD_PRELOAD /usr/lib/libefence.so
(gdb) run -DNYCd3
[...]
[interrupt]
(gdb) signal SIGINT
[...]
Program received signal SIGSEGV, Segmentation fault.
memPoolInUseCount (pool=0x40571fb0)
    at /home/henrik/SRC/squid/SQUIDCACHE/commit/src/MemPool.c:300
300 return pool->meter.inuse.level;
(gdb) where
#0 memPoolInUseCount (pool=0x40571fb0)
    at /home/henrik/SRC/squid/SQUIDCACHE/commit/src/MemPool.c:300
#1 0x0808594d in memCleanModule ()
    at /home/henrik/SRC/squid/SQUIDCACHE/commit/src/MemPool.c:121
#2 0x08084d28 in SquidShutdown (unused=0x0)
    at /home/henrik/SRC/squid/SQUIDCACHE/commit/src/main.c:991

(gdb) p *pool
$1 = {label = 0x80ed06a "NTLM Helper State data", obj_size = 16,
pstack = {
    capacity = 16, count = 1, items = 0x0}, meter = {alloc = {level =
1,
      hwater_level = 1, hwater_stamp = 1013731494}, inuse = {level =
0,
      hwater_level = 1836017711, hwater_stamp = 1701326693}, idle = {
      level = 1802072686, hwater_level = 1970369327,
      hwater_stamp = 1664050281}, saved = {count = 1701340001,
      bytes = 1635218223, gb = 1953705584}, total = {count =
778400865,
      bytes = 1634036835, gb = 110}}}

Tools I use in hunting memory issues:

a) memprof, finds those memory leaks at once with only a few clicks
and no false reports, and allows you to walk the stack traces
interactively. It's profile mode also allows one to track down
"forgotten but not technically leaked memory" even if the tool can be
improved a lot in that area.

b) electic fence, finds most memory corruptions when they occur. Best
used from within a debugger as shown above.

Regards
Henrik
Received on Thu Feb 14 2002 - 17:15:13 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:47 MST