Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 561875

Summary: Leak of FD in rmon-mib
Product: Red Hat Enterprise Linux 5 Reporter: Olivier Fourdan <ofourdan>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.4CC: jwest, kem, Klaus.Detsch, ksrot, mvadkert, plyons, robin.bowes, rvokal, tao, tiavina.randrezason
Target Milestone: rcKeywords: Patch, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 562108 (view as bug list) Environment:
Last Closed: 2011-07-21 09:08:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 562108, 585202, 651806, 651807    
Attachments:
Description Flags
Proposed patch none

Description Olivier Fourdan 2010-02-04 15:39:41 UTC
Created attachment 388816 [details]
Proposed patch

Description of problem:

In etherStatsTable_container_load() and dot3StatsTable_container_load(), the descriptor by socket() is not closed.

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

net-snmp-5.3.2.2-7.el5

How reproducible:

Always

Steps to Reproduce:
1. Configure /etc/snmp/snmpd.confview all MIBs.

    ------------------------------------
    view    systemview    included   .1
    ------------------------------------

2. Restart snmpd

3. Run snmpwalk to get MIB information.

    # snmpwalk -v 1 -c public localhost > /dev/null

4. Count the number of entries related to snmpd in lsof

    # lsof | grep snmpd | wc -l

5. Redo step 3. and 4. a few times
  
Actual results:

The number of files open by snmpd increases

Expected results:

The number of files open by snmpd remains stable

Additional info:

It seems etherStatsTable_container_load() and dot3StatsTable_container_load() do not close the descriptor returned by socket.

Closing the fd in etherStatsTable_container_load() and dot3StatsTable_container_load() seems to help limiting the number of descriptors used by snpmd over each snmpwalk run.

Comment 1 Jan Safranek 2010-02-05 10:56:37 UTC
I've fixed it upstream, SVN rev. 18101

Comment 2 Jan Safranek 2010-03-11 14:16:46 UTC
*** Bug 572206 has been marked as a duplicate of this bug. ***

Comment 5 Miroslav Vadkerti 2010-04-23 09:01:40 UTC
Putting QA_ACK, repro steps look clear. Adding RHTS keyword.

Comment 9 Robin Bowes 2010-05-31 21:03:55 UTC
I'm seeing something similar with net-snmp-5.4.2.1 that I've built from Fedora sources. However, neither of the sources files patched in this ticket are present in the 5.4.2.1 tarball.

Any ideas how to debug further?

R.

Comment 10 Robin Bowes 2010-06-12 12:21:01 UTC
What is particularly strange in my case is that I have > 100 machines, all configured identically (deployed with cobbler & maintained with puppet) and I'm only seeing the problem on this one machine.

It runs fine for some time, then snmp collection stops working with many lines like this in the log:

2010-06-12_07:55:55.87796 couldn't create socket

2010-06-12_08:00:55.87873 could not open /proc/net/if_inet6

2010-06-12_08:00:55.87884 error on subcontainer 'interface container' insert (-1)

Before finally seeing:

2010-06-12_08:05:55.88059 could not create socket
2010-06-12_08:05:55.88242 could not create socket
2010-06-12_08:05:58.14448 /proc/stat: Too many open files
2010-06-12_08:06:03.14449 /proc/stat: Too many open files
2010-06-12_08:06:08.14449 /proc/stat: Too many open files
2010-06-12_08:06:10.88056 cannot open /proc/net/dev ...
2010-06-12_08:06:13.14556 /proc/stat: Too many open files
2010-06-12_08:06:18.14560 /proc/stat: Too many open files
2010-06-12_08:06:23.14656 /proc/stat: Too many open files
2010-06-12_08:06:25.78956 cannot open /proc/net/snmp ...
2010-06-12_08:06:25.78959 cannot open /proc/net/snmp6 ...
2010-06-12_08:06:25.88056 cannot open /proc/net/dev ...

etc.

Comment 17 errata-xmlrpc 2011-07-21 09:08:25 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html

Comment 18 errata-xmlrpc 2011-07-21 12:20:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html