Maintained by: NLnet Labs

[Unbound-users] Is there any memory leak in unbound?

W.C.A. Wijngaards
Tue Sep 15 11:29:13 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tao Ma,

Just realized something else, the sbrk estimate is a dirty hack.
Gentoo may report a different sbrk() value, and the dirty hack
does not work.  The sbrk() value keeps growing but maybe it is
not true that unbound's memory keeps growing.  Does the 'top' or
'ps' memory number also grow?

Best regards,
   Wouter

On 09/15/2009 11:26 AM, W.C.A. Wijngaards wrote:
> Hi Tao Ma,
> 
>>     debug: cache memory msg=16528 rrset=33040 infra=672 val=24888
> 
> The values from your log file look very reasonable.  No problems here.
> The sbrk keeps growing?
> 
> Ok, it is possible to enable even more memory debug, configure with
> --enable-alloc-checks and compile again.   Unbound prints:
> info: Memory conditions: %u front=%u back=%u mesh=%u msg=%u rrset=%u
> infra=%u iter=%u val=%u alloccache=%u globalalloccache=%u me=%u
> But with values.
> 
> It also prints a log line for *every* alloc call.  So, you can see where
> in the code it allocates all that memory.   This will make the
> server very slow.  If you send me the log file (off-list to
> wouter at nlnetlabs.nl , then I can parse it with testcode/memstats.c;
> or you can do that yourself: make memstats ; ./memstats < logfile ).
> 
> To answer your question, unbound keeps some memory around, up to a
> maximum, because free-ing something that you need later again is slow.
> This should top out at 40Mb for the standard config.
> 
> Gentoo? Is it 64bit? Does it use a 'special' memory allocator in libc?
> 
> Best regards,
>    Wouter
> 
> On 09/11/2009 10:06 AM, Tao Ma wrote:
>> What's more,I found that the memory occupied by unbound would not be
>> freed when all requets finished,that means,unbound only consume memory
>> but never free them.
>> What does unbound hold the memory for?It quite like that  a memory leak
>> happens...
>> Anyone else has been in the same trouble?
> 
> 
>> Best Regards,
>> Tao Ma
> 
> 
>> --- *09t911åh”, Tao Ma /<matao_reg at yahoo.com.cn>/* ™S
> 
> 
>>     Ñöº: Tao Ma <matao_reg at yahoo.com.cn>
>>     ;˜: Re: [Unbound-users] Is there any memory leak in unbound?
>>     6öº: "W.C.A. Wijngaards" <wouter at nlnetlabs.nl>
>>     „: unbound-users at unbound.net
>>     å: 2009t911å,h”,
> H11:50
> 
>>     Hi Wouter,thanks very much for your reply.
> 
>>     I tried the method you mentioned,here is the info I got from the log:
>>     debug: cache memory msg=16528 rrset=33040 infra=672 val=24888
>>     This info keeps the same from the start of the unbound(I have only
>>     about 5 records in unbound).
> 
>>     I also found the value of mem.total.sbrk printed by "unbound-control
>>     stats" keeps growing.The item "mem.total.sbrk" is an estimate of the
>>     heap size of unbound in bytes,it is close to the memory used by unbound.
> 
>>     I have a script keeps recording mem.total.sbrk in a file,and found
>>     when mem.total.sbrk grew to 2017873920,unbound was killed by
>>     system(My server has a 2G memory).
> 
>>     Unbound runs in a Gentoo Linux with 2.6.23 kernel,does the problem
>>     relate to the OS?
> 
>>     Thanks & Best regards,
>>     Tao Ma
> 
> 
> 
>>     --- *09t910åhÛ, W.C.A. Wijngaards /<wouter at NLnetLabs.nl>/*
>>     ™S
> 
> 
>>         Ñöº: W.C.A. Wijngaards <wouter at NLnetLabs.nl>
>>         ;˜: Re: [Unbound-users] Þ  Re: Is there any memory leak in
>>         unbound?
>>         6öº: "Tao Ma" <matao_reg at yahoo.com.cn>
>>         „: "Paul Wouters" <paul at xelerance.com>, unbound-users at unbound.net
>>         å: 2009t910å,hÛ,H10:25
> 
>>         -----BEGIN PGP SIGNED MESSAGE-----
>>         Hash: SHA1
> 
>>         Hi Tao Ma,
> 
>>         The memory statistics that unbound makes can help?
> 
>>         It prints them into the log file (depending on verbosity
>>         level and --enable-debug to configure) like this:
>>         debug: cache memory msg=1620127 rrset=2964258 infra=738306
>>         val=128832
> 
>>         Also the memory statistics are printed when you enable extended
>>         statistics and do unbound-control stats, like this:
>>         mem.cache.rrset=2980222
>>         mem.cache.message=1633031
>>         mem.mod.iterator=16460
>>         mem.mod.validator=130126
> 
>>         Best regards,
>>            Wouter
> 
> 
>>     ------------------------------------------------------------------------
>>     }©:aI`Ñ®±:ah°
> ¿
>>     <http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/>
> 
>>     -----b:Dö
¹-----
> 
>>     _______________________________________________
>>     Unbound-users mailing list
>>     Unbound-users at unbound.net </mc/compose?to=Unbound-users at unbound.net>
>>     http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
> 
> 
>> ------------------------------------------------------------------------
>> }©:aI`Ñ®±:ah°
> ¿
>> <http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/>
> 
> 
_______________________________________________
Unbound-users mailing list
Unbound-users at unbound.net
http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkqvXmkACgkQkDLqNwOhpPisoACeKatx2Pl4/B7k5MtJ86KTPBaR
2WkAn0sd6bW9UDjCbdQ4pOLHW2WiFOg+
=NrkI
-----END PGP SIGNATURE-----