Hello, main issue being reported is "Memory Leaks" in net-snmp v5.7.2
and v5.7.1.
Support Key: 44ae-0f1e-cd36-1abb

First off I am totally new to net-snmp and the support forum mechanism
usage, so I hope I am posting to the right forum. I just want to get
this memory leaking issues reported and fixed.

I have been developing a snmp trap forwarder using net-snmp v5.7.1
package on a Linux RHEL5 server.
I had made a lot of modifications to the snmptrapd so that it can filter
and/or manipulate traps based on trap OID and then forwards the desired
traps on to 3 destinations.
Thus, I have modified the snmptrapd.c and snmptrapd_handlers.c programs.
I have added logic to the snmptrapd.c program to open 3 destination
ports (sessions) and added reading in my own custom configuration file
to specify the trap filtering parameters. The 3 opened sessions remain
opened for the duration of running the snmptrapd program.
In the snmptrapd_handlers.c program, I've added logic in the snmp_input
callback section to examine the received traps and set filters to either
forward the trap or to ignore and not forward the trap to the 3
forwarding destination session ports. I clone the original pdu several
times to send to the various destination ports. (I free all pdu's after
sending or blocking the trap).
I also added logic to the snmptrapd_handlers.c (forward_handler callback
routine) modify certain traps adding and appending the agent ipaddress
as an extra varbind to some trap pdu's before forwarding it. 
I also have a special case where I have to clone just the pdu header and
then re-populate the trap's varbinds with translated to text varbind
values.
In all the new logic that I've added, I've checked over and over to make
sure I am free'ing up any allocated memory.
valgrind utility reports no memory lost and no errors now.

But when I run the snmptrapd program, it slowly creeps up in memory
usage until it consumes all of the systems memory!

I have in the snmptrapd.conf file these handlers turned on:
snmpTrapdAddr 192.168.1.16:162
authCommunity log,net public
forward default udp:192.168.1.15:162
format1 %t %.4y-%.2m-%.2l %.2h:%.2j:%.2k Received event %s %A (via [%b];
%V;%v\n
format2 %t %.4y-%.2m-%.2l %.2h:%.2j:%.2k Received event %s %A (via [%b];
%V;%v\n

I have done as thorough a check as I can up to this point to ensure none
of my own added code is leaking and locking up the system memory.

I have tried disabling the forward_handler and run it with the logging
handler only to isolate the trap forwarder logic out of the equation and
it still leaks memory.

I have tried disabling the log handler and run only the forward handler
too and it still leaks memory.

The memory usage gradually increases as trap activity is received no
matter which handler is enabled or disabled. This leads me to suspect
that somewhere in the net-snmp handler dispatching or callback mechanism
or elsewhere is continually allocating bits of memory to variables that
it keeps around forever.  Thus eating up memory as time runs on.

Also, I should mention that I do have configured snmp.conf file to load
in a bunch of MIBS along with the default standard MIBS that come with
the net-snmp package.

When I installed and built the package I used the following configure
command:
./configure --enable-embedded-perl --enable-shared
I ran make
I ran make test
I ran as root, make install
using the default install directories of /usr/local

I am at my wits end.
Where can there be memory allocations happening in the net-snmp v5.7.1
and v5.7.2 package that eats up memory like this? Is it in the logging
format checking routines? Is it in the MIB parsing routines? Is it in
the handler dispatching routines? Where in net-snmp code can it
constantly be adding to a memory variable increasing it in size with
time?
I had developed this code for a critical project which was about to be
deployed but then during User Acceptance Testing they discovered that
snmptrapd was eating up all the system memory and now the project is
delayed and on hold.
Desperately need help in locating the memory allocations in net-snmp
causing this.

Also if it helps, this happens on both a Fedora OS as well as Linux
RHEL5 OS server. Also, I'm pretty sure even if I compile the original
snmptrapd programs that come with the package and run it, it also will
show memory usage creeping up. So it is inherent in the package.
Any ideas or patches to fix this?

Thank You!

Bill Yee


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to