Bug 85071

Summary: ipv6 net-snmp 5.0.x seems to leave descriptors behind
Product: [Retired] Red Hat Raw Hide Reporter: Kaj J. Niemi <kajtzu>
Component: net-snmpAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 1.0CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-04-29 12:43:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
output of lsof -p on a snmpd
Patch fixing missing close for IPV6IFADMSTATUS/IPV6IFOPERSTATUS. none

Description Kaj J. Niemi 2003-02-25 10:56:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030221

Description of problem:
net-snmp 5.0.6/5.0.7 seems to leave sockets/descriptors behind. When it finally
dies the only thing that appears in /var/log/messages is:

Feb 25 06:43:34 ag01 snmpd[23039]: Connection from
Feb 25 06:44:23 ag01 last message repeated 4 times
Feb 25 06:44:23 ag01 last message repeated 4 times
Feb 25 06:44:23 ag01 snmpd[23039]: warning: cannot open /etc/hosts.allow: Too
many open files
Feb 25 06:44:23 ag01 snmpd[23039]: warning: cannot open /etc/hosts.deny: Too
many open files
Feb 25 06:44:23 ag01 snmpd[23039]: Connection from

I am able to reproduce this rather reliably on RH73, RH80, Phoebe 1/2/3 and Rawhide.

Attached is output of lsof -p process which doesn't really help but shows a
bunch of socks that aren't identifiable.

Any pointers on how to catch this?

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Start snmpd
2. Issue queries (a lot of them)
3. Wait for snmpd to exit almost silently.

Actual Results:  snmpd exits after all descriptors are in use

Expected Results:  snmpd should not experience descriptor exhaustion.

Additional info:

Comment 1 Kaj J. Niemi 2003-02-25 10:59:43 UTC
Created attachment 90344 [details]
output of lsof -p on a snmpd

Comment 2 Kaj J. Niemi 2003-02-25 14:17:41 UTC
This bug is NOT reproduceable unless there the IPv6 stack is enabled (dual-stack
makes it reproduceable as well.)

Suppose pid 17703 is the 'snmpd' process and one monitors the descriptors with
lsof as follows:

% while (true) {
lsof -p 17703 | wc ; sleep 2

and one walks the IPv6 interfaces tree with

snmpwalk -O n -v 2c -c quux .

the socket count goes up (as witnessed by running lsof every two seconds.)
towards infinity until the open file descriptor limit is reached (at which point
snmpd dies.)

Comment 3 Kaj J. Niemi 2003-02-25 15:04:32 UTC
Simplest reproduceable case is the following (requesting
IPV6-MIB::ipv6IfAdminStatus) which leaves behind one new socket.

snmpget -O n -v 2c -c quux .

Patch follows. ;-)

Comment 4 Kaj J. Niemi 2003-02-25 15:06:15 UTC
Created attachment 90351 [details]
Patch fixing missing close for IPV6IFADMSTATUS/IPV6IFOPERSTATUS.

Seems to work.

Comment 5 Kaj J. Niemi 2003-02-25 15:07:50 UTC
This should probably be fixed upstream, too...

Comment 6 Kaj J. Niemi 2003-03-26 11:27:30 UTC
Not fixed in 5.0.8, patch still applies.

Comment 7 Phil Knirsch 2003-04-29 12:43:09 UTC
Package updated and patch included in latest rawhide version (to appear real soon).

Read ya, Phil

Comment 8 Michael J. Slifcak 2004-09-16 02:16:30 UTC
The patch is needed ONLY if using net-snmp-5.0.9 as a base.
The net-snmp-5.1.2 and later releases close the socket
   several lines earlier in the code fragment.
Please do not include net-snmp-5.0.8-ipv6-sock-close.patch
in upcoming source packages that are based on net-snmp-5.1.2.