First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 109785
Alias:
Product:
Component:
Status: RESOLVED
Resolution: WONTFIX
Assigned To: Netmon Herd <netmon@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Ronan Mullally <ronan@iol.ie>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
valgrind.log valgrind.log text/plain Marcelo Goes 2006-01-12 16:07 0000 5.71 KB Details
net-snmp-lm_sensors-memleak.patch fix memory leaks in hr_sensor.c patch Alex 2006-04-17 11:25 0000 1.45 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 109785 depends on: Show dependency tree
Bug 109785 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-10-19 02:59 0000
There appears to be a memory leak in net-snmp (5.2.1.2-r1) with +lm_sensors.

I've verified lm_sensors is the culprit by re-compiling net-snmp with it
disabled.  With the patch enabled the memory footprint for the snmpd process
grows - I've seen it reach 50MB after a couple of weeks (being queried every 5
minutes).  With the patch disabled net-snmp remains a fairly constant 9MB.

Reproducible: Always
Steps to Reproduce:
1. Install net-snmp with +lm_sensors
2. Start net-snmp, note memory usage
3. Query it every 5 minutes
4. Note memory usage a week later

Actual Results:  
net-snmp memory footprint grows


Portage 2.0.51.22-r3 (hardened/x86/2.6, gcc-3.4.3, glibc-2.3.5-r2,
2.6.11-hardened-r15 i686)
=================================================================
System uname: 2.6.11-hardened-r15 i686 Intel(R) Xeon(TM) CPU 2.80GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -mfpmath=sse -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -mfpmath=sse -fomit-frame-pointer -pipe"
DISTDIR="/var/lib/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS=" http://gentoo.blueyonder.co.uk/
ftp://ftp.mirror.ac.uk/sites/distro.ibiblio.org/pub/linux/distributions/gentoo/
ftp://ftp.belnet.be/mirrors/rsync.gentoo.org/gentoo
ftp://ftp.easynet.nl/mirror/gentoo/"
MAKEOPTS="-j4"
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="acl acpi apache2 berkdb bzlib caps crypt dlloader gd gdbm gnutls hardened
ipv6 jpeg libwww lm_sensors minimal mysql mysqli ncurses netboot nls nocardbus
nptl pam pcre perl pic pie png readline sasl session shared sharedmem snmp sse
ssl tcpd threads userlocales x86 zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS

/etc/portage/package.use:
net-analyzer/net-snmp           -minimal -perl -ipv6

------- Comment #1 From Andreas Mixich 2005-10-28 13:28:05 0000 -------
(In reply to comment #0)
I do have the same issues. It is sufficient to issue several requests to the
snmpd per second over the span of a few hours to have snmpd consume more than 100MB.

------- Comment #2 From Marcelo Goes 2006-01-12 16:07:53 0000 -------
Created an attachment (id=76955) [edit]
valgrind.log

Indeed, there is a memory leak related to the patch.

Tested with:
valgrind --leak-check=yes /usr/sbin/snmpd &> valgrind.log

------- Comment #3 From Marcelo Goes 2006-01-22 17:30:08 0000 -------
I had a look at Fedora's rawhide (the patch came originally from RedHat), and
it seems this patch is gone from their sources altogether.
I do not have the Valgrind expertise to fix this problem.

I commented the parts of the ebuilds related to the patch so that people who
really want it can simply comment it out. I am not doing a revision bump
because the lm_sensors USE flag is off by default and net-snmp is a lengthy
compile.

netmon: if you feel differently, please revbump 5.2.1.2-r1 and 5.2.2-r1.

I'm marking this as WONTFIX. If anyone believes himself to be able to fix this
problem, please reopen the bug and attach a patch.

------- Comment #4 From Jakub Moc (RETIRED) 2006-01-31 03:37:46 0000 -------
*** Bug 121031 has been marked as a duplicate of this bug. ***

------- Comment #5 From Daniel Willmann 2006-01-31 18:46:03 0000 -------
There is no need to disable the lm_sensors useflag completely since net-snmp
already has support for it builtin.
Just uncomment
use lm_sensors && mibs="${mibs} ucd-snmp/lmSensors"
in src_compile (and the DEPEND one) and remerge net-snmp with lm_sensors
useflag enabled.
I'm running a
while (true); do snmpwalk -v 2c -c public localhost >/dev/null; done
right now and there's no change in memory consumption (as shown in top) so I'm
assuming that the memory leak is in the patch.

I'm wondering if we even need that patch since the output looks fine form what
I can tell.

------- Comment #6 From Marcelo Goes 2006-02-04 10:10:31 0000 -------
Thanks Daniel, your suggestion is in cvs.

------- Comment #7 From Alex 2006-04-17 11:25:46 0000 -------
Created an attachment (id=84849) [edit]
fix memory leaks in hr_sensor.c

apply after original net-snmp-lm_sensors.patch

------- Comment #8 From Torbjörn Svensson 2006-05-17 09:37:43 0000 -------
I would change this row:
strncpy(string, sensor->name, strlen(sensor->name));
to:
strncpy(string, sensor->name, sizeof(string));
as it may lead to an buffer overflow if sensor->name is longer than string. I
may be wrong as I am no C programmer, but that's my 2 cents =)

First Last Prev Next    No search results available      Search page      Enter new bug