<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Wouter,I'm very glad to tell you,I patched the diff file you gave me and now unbound works well on the server,thanks very much!<br><br>I'm sorry that I didn't tell you clearly about the compile problem.When we found we couldn't compile the code with "--enable-alloc-checks",we added another option "--enable-static-exe" and then finished compiling smoothly,that's all.<br><br>Thanks again for your warmhearted help.<br><br>Best Regards,<br>Tao Ma<br><br>--- <b>09年9月16日,周三, W.C.A. Wijngaards <i><wouter@nlnetlabs.nl></i></b> 写道:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>发件人: W.C.A. Wijngaards <wouter@nlnetlabs.nl><br>主题: Re: [Unbound-users] Is there any memory leak in unbound?<br>收件人: "Tao Ma" <matao_reg@yahoo.com.cn><br>日期:
2009年9月16日,周三,下午8:47<br><br><div class="plainMail">Hi Tao Ma,<br><br>Does this solve your memory leak problem?<br><br>Index: libunbound/libworker.c<br>===================================================================<br>--- libunbound/libworker.c (revision 1831)<br>+++ libunbound/libworker.c (working copy)<br>@@ -514,6 +514,7 @@<br> ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags);<br> if(local_zones_answer(ctx->local_zones, &qinfo, &edns,<br> w->back->udp_buff, w->env->scratch)) {<br>+ regional_free_all(w->env->scratch);<br> libworker_fillup_fg(q, LDNS_RCODE_NOERROR,<br> w->back->udp_buff, sec_status_insecure);<br>
libworker_delete(w);<br>@@ -630,6 +631,7 @@<br> ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags);<br> if(local_zones_answer(w->ctx->local_zones, &qinfo, &edns,<br> w->back->udp_buff, w->env->scratch)) {<br>+ regional_free_all(w->env->scratch);<br> q->msg_security = sec_status_insecure;<br> add_bg_result(w, q, w->back->udp_buff, UB_NOERROR);<br> free(qinfo.qname);<br>Index: daemon/worker.c<br>===================================================================<br>--- daemon/worker.c (revision 1831)<br>+++ daemon/worker.c (working copy)<br>@@ -806,6 +806,7 @@<br>
}<br> if(local_zones_answer(worker->daemon->local_zones, &qinfo, &edns,<br> c->buffer, worker->scratchpad)) {<br>+ regional_free_all(worker->scratchpad);<br> if(ldns_buffer_limit(c->buffer) == 0) {<br> comm_point_drop_reply(repinfo);<br> return 0;<br><br>Sorry about the compile problem with unbound-host and alloc-checks, I'll <br>look at it later.<br><br>Best regards,<br> Wouter<br><br><br>On 09/16/2009 10:05 AM, Tao Ma wrote:<br>> Hi Wouter,thanks for your reply.<br>><br>> We use a 32-bit Gentoo and I don't think there's a special memory<br>> allocator in libc.<br>> I can always find the memory consumed by
unbound keep growing from ouput<br>> of 'ps' and 'top',the result of sbrk estimate seems to be in accord with<br>> this.<br>><br>> Following your suggestion,we configure with --enable-alloc-checks and<br>> compile unbound again,now we can find the "Memory conditions" value keep<br>> growing in the log.<br>><br>> We use memstats to parse the log,but found nothing but the following ouput:<br>> Reading /var/unbound/log_test of size 38767531<br>> 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20%<br>> 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38%<br>> 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56%<br>> 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74%<br>> 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92%<br>> 93% 94% 95% 96% 97% 98% 99% 100% done<br>> ------------<br>> 0 / 0 total in 0 code
lines<br>><br>> We got a complete record in the log from the start of unbound to the<br>> exiting of unbound,and the log file has been attatched to the mail,maybe<br>> it will help you to analyse.<br>><br>> Let me know if you find any mistakes in my operation.<br>><br>> By the way,when we configure unbound-1.3.3 with "./configure<br>> --prefix=/usr/local/unbound --enable-alloc-checks" and compile,we got<br>> the following error:<br>> build/smallapp/.libs/unbound-host.o: In function `print_rd':<br>> /home/mt/tools/unbound-1.3.3/smallapp/unbound-host.c:233: undefined<br>> reference to `unbound_stat_malloc_log'<br>> /home/mt/tools/unbound-1.3.3/smallapp/unbound-host.c:255: undefined<br>> reference to `unbound_stat_free_log'<br>> build/smallapp/.libs/unbound-host.o: In function `pretty_rdata':<br>> /home/mt/tools/unbound-1.3.3/smallapp/unbound-host.c:247: undefined<br>> reference to
`unbound_stat_free_log'<br>> build/smallapp/.libs/unbound-host.o: In function `lookup':<br>> /home/mt/tools/unbound-1.3.3/smallapp/unbound-host.c:384: undefined<br>> reference to `unbound_stat_free_log'<br>> collect2: ld returned 1 exit status<br>> make: *** [unbound-host] Error 1<br>><br>> We did some modification to the code and finished compiling.Is there<br>> anything wrong in the code?<br>><br>> Thanks & Best regards,<br>> Tao Ma<br>><br>><br>><br>> --- *09年9月15日,周二, W.C.A. Wijngaards /<<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a>>/* 写道:<br>><br>><br>> 发件人: W..C.A. Wijngaards <<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a>><br>> 主题: Re: [Unbound-users] Is there any memory leak in
unbound?<br>> 收件人: "W.C.A. Wijngaards" <<a ymailto="mailto:wouter@nlnetlabs.nl" href="/mc/compose?to=wouter@nlnetlabs.nl">wouter@nlnetlabs.nl</a>><br>> 抄送: "Tao Ma" <<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a>>, <a ymailto="mailto:unbound-users@unbound.net" href="/mc/compose?to=unbound-users@unbound.net">unbound-users@unbound.net</a><br>> 日期: 2009年9月15日,周二,下午5:29<br>><br>> -----BEGIN PGP SIGNED MESSAGE-----<br>> Hash: SHA1<br>><br>> Hi Tao Ma,<br>><br>> Just realized something else, the sbrk estimate is a dirty hack.<br>> Gentoo may report a different sbrk() value, and the dirty hack<br>> does not
work. The sbrk() value keeps growing but maybe it is<br>> not true that unbound's memory keeps growing. Does the 'top' or<br>> 'ps' memory number also grow?<br>><br>> Best regards,<br>> Wouter<br>><br>> On 09/15/2009 11:26 AM, W.C.A. Wijngaards wrote:<br>> > Hi Tao Ma,<br>> ><br>> >> debug: cache memory msg=16528 rrset=33040 infra=672 val=24888<br>> ><br>> > The values from your log file look very reasonable. No problems here.<br>> > The sbrk keeps growing?<br>> ><br>> > Ok, it is possible to enable even more memory debug, configure with<br>> > --enable-alloc-checks and compile
again. Unbound prints:<br>> > info: Memory conditions: %u front=%u back=%u mesh=%u msg=%u rrset=%u<br>> > infra=%u iter=%u val=%u alloccache=%u globalalloccache=%u me=%u<br>> > But with values.<br>> ><br>> > It also prints a log line for *every* alloc call. So, you can see<br>> where<br>> > in the code it allocates all that memory. This will make the<br>> > server very slow. If you send me the log file (off-list to<br>> > <a ymailto="mailto:wouter@nlnetlabs.nl" href="/mc/compose?to=wouter@nlnetlabs.nl">wouter@nlnetlabs.nl</a> </mc/compose?to=<a ymailto="mailto:wouter@nlnetlabs.nl" href="/mc/compose?to=wouter@nlnetlabs.nl">wouter@nlnetlabs.nl</a>> , then I<br>> can parse it with
testcode/memstats.c;<br>> > or you can do that yourself: make memstats ; ./memstats < logfile ).<br>> ><br>> > To answer your question, unbound keeps some memory around, up to a<br>> > maximum, because free-ing something that you need later again is<br>> slow.<br>> > This should top out at 40Mb for the standard config.<br>> ><br>> > Gentoo? Is it 64bit? Does it use a 'special' memory allocator in<br>> libc?<br>> ><br>> > Best regards,<br>> > Wouter<br>> ><br>> > On 09/11/2009 10:06 AM, Tao Ma wrote:<br>> >> What's more,I found that the memory occupied by unbound
would not be<br>> >> freed when all requets finished,that means,unbound only consume<br>> memory<br>> >> but never free them.<br>> >> What does unbound hold the memory for?It quite like that a<br>> memory leak<br>> >> happens...<br>> >> Anyone else has been in the same trouble?<br>> ><br>> ><br>> >> Best Regards,<br>> >> Tao Ma<br>> ><br>> ><br>> >> --- *09t911氓h聰, Tao Ma /<<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a><br>> </mc/compose?to=<a
ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a>>>/* 聶S<br>> ><br>> ><br>> >> 脩枚潞: Tao Ma <<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a><br>> </mc/compose?to=<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a>>><br>> >> ;聵: Re: [Unbound-users] Is there any memory leak in unbound?<br>> >> 6枚潞: "W.C.A. Wijngaards" <<a ymailto="mailto:wouter@nlnetlabs.nl" href="/mc/compose?to=wouter@nlnetlabs.nl">wouter@nlnetlabs.nl</a><br>> </mc/compose?to=<a ymailto="mailto:wouter@nlnetlabs.nl"
href="/mc/compose?to=wouter@nlnetlabs.nl">wouter@nlnetlabs.nl</a>>><br>> >> 聞: <a ymailto="mailto:unbound-users@unbound.net" href="/mc/compose?to=unbound-users@unbound.net">unbound-users@unbound.net</a><br>> </mc/compose?to=<a ymailto="mailto:unbound-users@unbound.net" href="/mc/compose?to=unbound-users@unbound.net">unbound-users@unbound.net</a>><br>> >> 氓: 2009t911氓,h聰,<br>> > H11:50<br>> ><br>> >> Hi Wouter,thanks very much for your reply.<br>> ><br>> >> I tried the method you mentioned,here is the info I got from the<br>> log:<br>> >> debug: cache memory msg=16528 rrset=33040 infra=672 val=24888<br>> >> This info keeps the same
from the start of the unbound(I have only<br>> >> about 5 records in unbound).<br>> ><br>> >> I also found the value of mem..total.sbrk printed by<br>> "unbound-control<br>> >> stats" keeps growing.The item "mem.total.sbrk" is an estimate of the<br>> >> heap size of unbound in bytes,it is close to the memory used by<br>> unbound.<br>> ><br>> >> I have a script keeps recording mem.total.sbrk in a file,and found<br>> >> when mem.total.sbrk grew to 2017873920,unbound was killed by<br>> >> system(My server has a 2G memory).<br>> ><br>> >> Unbound runs in a Gentoo Linux with 2.6.23 kernel,does the
problem<br>> >> relate to the OS?<br>> ><br>> >> Thanks & Best regards,<br>> >> Tao Ma<br>> ><br>> ><br>> ><br>> >> --- *09t910氓h脹, W.C.A. Wijngaards /<<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a><br>> </mc/compose?to=<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a>>>/*<br>> >> 聶S<br>> ><br>> ><br>> >> 脩枚潞: W.C.A. Wijngaards <<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a><br>>
</mc/compose?to=<a ymailto="mailto:wouter@NLnetLabs.nl" href="/mc/compose?to=wouter@NLnetLabs.nl">wouter@NLnetLabs.nl</a>>><br>> >> ;聵: Re: [Unbound-users] 脼 Re: Is there any memory leak in<br>> >> unbound?<br>> >> 6枚潞: "Tao Ma" <<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a><br>> </mc/compose?to=<a ymailto="mailto:matao_reg@yahoo.com.cn" href="/mc/compose?to=matao_reg@yahoo.com.cn">matao_reg@yahoo.com.cn</a>>><br>> >> 聞: "Paul Wouters" <<a ymailto="mailto:paul@xelerance.com" href="/mc/compose?to=paul@xelerance.com">paul@xelerance.com</a><br>> </mc/compose?to=<a ymailto="mailto:paul@xelerance.com"
href="/mc/compose?to=paul@xelerance.com">paul@xelerance.com</a>>>, <a ymailto="mailto:unbound-users@unbound.net" href="/mc/compose?to=unbound-users@unbound.net">unbound-users@unbound.net</a><br>> </mc/compose?to=<a ymailto="mailto:unbound-users@unbound.net" href="/mc/compose?to=unbound-users@unbound.net">unbound-users@unbound.net</a>><br>> >> 氓: 2009t910氓,h脹,H10:25<br>> ><br>> >> -----BEGIN PGP SIGNED MESSAGE-----<br>> >> Hash: SHA1<br>> ><br>> >> Hi Tao Ma,<br>> ><br>> >> The memory statistics that unbound makes can help?<br>> ><br>> >> It prints them into the log file (depending on verbosity<br>> >> level
and --enable-debug to configure) like this:<br>> >> debug: cache memory msg=1620127 rrset=2964258 infra=738306<br>> >> val=128832<br>> ><br>> >> Also the memory statistics are printed when you enable extended<br>> >> statistics and do unbound-control stats, like this:<br>> >> mem.cache.rrset=2980222<br>> >> mem.cache.message=1633031<br>> >> mem.mod.iterator=16460<br>> >> mem.mod.validator=130126<br>> ><br>> >> Best regards,<br>> >> Wouter<br>> ><br>> ><br>> >><br>>
------------------------------------------------------------------------<br>> >> }漏:aI`脩庐卤:ah掳<br>> > 驴<br>> >><br>> <<a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/" target="_blank">http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/</a>><br>> ><br>> >> -----b:D枚聟鹿-----<br>> ><br>> >> _______________________________________________<br>> >> Unbound-users mailing list<br>> >> <a ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a><br>> </mc/compose?to=<a
ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a>><br>> </mc/compose?to=<a ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a><br>> </mc/compose?to=<a ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a>>><br>> >> <a href="http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users" target="_blank">http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users</a><br>> ><br>> ><br>> >><br>> ------------------------------------------------------------------------<br>> >> }漏:aI`脩庐卤:ah掳<br>>
> 驴<br>> >><br>> <<a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/" target="_blank">http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/</a>><br>> ><br>> ><br>> _______________________________________________<br>> Unbound-users mailing list<br>> <a ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a> </mc/compose?to=<a ymailto="mailto:Unbound-users@unbound.net" href="/mc/compose?to=Unbound-users@unbound.net">Unbound-users@unbound.net</a>><br>> <a href="http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users"
target="_blank">http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users</a><br>><br>> -----BEGIN PGP SIGNATURE-----<br>> Version: GnuPG v1.4.9 (GNU/Linux)<br>> Comment: Using GnuPG with Fedora - <a href="http://enigmail.mozdev.org/" target="_blank">http://enigmail.mozdev.org/</a><br>><br>> iEYEARECAAYFAkqvXmkACgkQkDLqNwOhpPisoACeKatx2Pl4/B7k5MtJ86KTPBaR<br>> 2WkAn0sd6bW9UDjCbdQ4pOLHW2WiFOg+<br>> =NrkI<br>> -----END PGP SIGNATURE-----<br>><br>><br>> ------------------------------------------------------------------------<br>> 好玩贺卡等你发,邮箱贺卡全新上线!<br>> <<a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/"
target="_blank">http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/</a>><br>><br><br></div></blockquote></td></tr></table><br>
<hr size=1><a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/"> 好玩贺卡等你发,邮箱贺卡全新上线!</a>