[Pkg-net-snmp-devel] Bug#510495: memory profiler results

John Morrissey jwm at horde.net
Fri Jan 16 17:25:27 UTC 2009


Ran valgrind on etch and lenny snmpds. The code has changed a bit between
the two versions, but they leak in substantially the same way: while
periodically fetching interface information to store in an in-memory cache.

Not sure why valgrind(1) could resolve some symbols and not others in the
same library; the libraries were stripped in both cases, since I used the
stock Debian net-snmp binaries.

I don't see any smoking guns, but in the lenny case, I suspect something's
going sideways in ipAddressTable_container_load() where it's iterating over
the list of interface information to find updates. I haven't had a chance to
look that closely at the etch case.

The next step would probably involve running snmpd in debug mode and
comparing the output to what's being done in the source. Poking at the
functions in these backtraces with gdb(1) might be more productive.

etch:
$ sudo valgrind --leak-check=full -- /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -f
[...]
==19648== 411,201 (355,752 direct, 55,449 indirect) bytes in 549 blocks are definitely lost in loss record 87 of 87
==19648==    at 0x401C6CA: calloc (vg_replace_malloc.c:279)
==19648==    by 0x409BB7E: ipAddressTable_allocate_rowreq_ctx (in /usr/lib/libnetsnmpmibs.so.9.0.1)
==19648==    by 0x409F377: (within /usr/lib/libnetsnmpmibs.so.9.0.1)
==19648==    by 0x4260D23: (within /usr/lib/libnetsnmp.so.9.0.1)
==19648==    by 0x409F20A: ipAddressTable_cache_load (in /usr/lib/libnetsnmpmibs.so.9.0.1)
==19648==    by 0x409C717: (within /usr/lib/libnetsnmpmibs.so.9.0.1)
==19648==    by 0x41D0D47: (within /usr/lib/libnetsnmphelpers.so.9.0.1)
==19648==    by 0x42466E2: run_alarms (in /usr/lib/libnetsnmp.so.9.0.1)
==19648==    by 0x804AF57: (within /usr/sbin/snmpd)
==19648==    by 0x42FD3BD: (below main) (libc-start.c:237)
==19648==
==19648== LEAK SUMMARY:
==19648==    definitely lost: 359,396 bytes in 558 blocks.
==19648==    indirectly lost: 58,689 bytes in 2,242 blocks.
==19648==      possibly lost: 0 bytes in 0 blocks.
==19648==    still reachable: 441,165 bytes in 15,242 blocks.
==19648==         suppressed: 0 bytes in 0 blocks.

lenny:
$ sudo valgrind --leak-check=full -- /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -f
[...]
==29991== 358,392 (188,352 direct, 170,040 indirect) bytes in 2,616 blocks are definitely lost in loss record 112 of 113
==29991==    at 0x4C203E4: calloc (vg_replace_malloc.c:397)
==29991==    by 0x53684DC: netsnmp_access_ipaddress_entry_create (in /usr/lib/libnetsnmpmibs.so.15.1.0)
==29991==    by 0x5369054: _load_v6 (in /usr/lib/libnetsnmpmibs.so.15.1.0)
==29991==    by 0x53694F3: netsnmp_arch_ipaddress_container_load (in /usr/lib/libnetsnmpmibs.so.15.1.0)
==29991==    by 0x5368936: netsnmp_access_ipaddress_container_load (in /usr/lib/libnetsnmpmibs.so.15.1.0)
==29991==    by 0x534B495: ipAddressTable_container_load (in /usr/lib/libnetsnmpmibs.so.15.1.0)
==29991==    by 0x5076F83: (within /usr/lib/libnetsnmphelpers.so.15.1.0)
==29991==    by 0x564343B: run_alarms (in /usr/lib/libnetsnmp.so.15.1.0)
==29991==    by 0x40456C: main (in /usr/sbin/snmpd)
==29991==
==29991== LEAK SUMMARY:
==29991==    definitely lost: 189,639 bytes in 2,628 blocks.
==29991==    indirectly lost: 171,048 bytes in 7,861 blocks.
==29991==      possibly lost: 0 bytes in 0 blocks.
==29991==    still reachable: 1,144,617 bytes in 17,142 blocks.
==29991==         suppressed: 0 bytes in 0 blocks.

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__





More information about the Pkg-net-snmp-devel mailing list