Bug 736258 - Use "ctrl+c" to close libvirtMib_subagent will lead to memory leak
Summary: Use "ctrl+c" to close libvirtMib_subagent will lead to memory leak
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt-snmp
Version: 6.2
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
Depends On:
Blocks: 896690 960054
TreeView+ depends on / blocked
Reported: 2011-09-07 07:53 UTC by xhu
Modified: 2013-11-21 21:40 UTC (History)
11 users (show)

Fixed In Version: libvirt-snmp-0.0.2-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-11-21 21:40:22 UTC
Target Upstream Version:

Attachments (Terms of Use)
memory leak info (2.46 KB, text/plain)
2011-09-07 07:53 UTC, xhu
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1666 0 normal SHIPPED_LIVE libvirt-snmp bug fix update 2013-11-20 21:52:59 UTC

Description xhu 2011-09-07 07:53:19 UTC
Created attachment 521807 [details]
memory leak info

Description of problem:
Use "ctrl+c" to close libvirtMib_subagent will lead to memory leak

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

How reproducible:

Steps to Reproduce:
1. install libvirt-snmp libvirt-snmp-debuginfo valgrind
# sudo yum install libvirt-snmp libvirt-snmp-debuginfo valgrind
2. prepare /etc/snmp/snmpd.conf as follows:
# cat /etc/snmp/snmpd.conf
rwcommunity public
master agentx
trapcommunity public
trap2sink  localhost

3. append the following lines to /etc/snmp/snmptrapd.conf
# Example configuration file for snmptrapd
authCommunity log,execute,net public
logOption f /var/log/snmptraps.log

4. add the following lines to /etc/sysconfig/snmptrapd:
OPTIONS="-m ALL -p /var/run/snmptrapd.pid"

5. restart snmpd and snmptrapd service
# service snmpd restart
# service snmptrapd restart

6. run libvirt snmp agent daemon
LIBVIRT_DEFAULT_URI="qemu:///system" valgrind --leak-check=full libvirtMib_subagent -f -L >& tmp.log 2>&1

7. use "ctrl+c" twice to close libvirtMib_subagent
Actual results:
There is memory leak and the details can be seen in the "tmp.log" attachment.

Expected results:
There is no memory leak

Additional info:
Sometimes the libvirtd will die

Comment 2 Martin Kletzander 2012-02-03 10:22:27 UTC
I confirm the bug, it's easy to reproduce but I haven't seen the libvirt daemon affected in any way.

Comment 4 Martin Kletzander 2012-05-30 15:31:18 UTC
Two fixes have been needed to do this, one was fixed earlier in the library, the second one was pushed into the snmp code now:

commit 22c2f5fd91a63d817199b42e695a87dab28ad0c1
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Wed May 30 14:30:02 2012 +0200

    Stop event thread on server stop

Comment 6 RHEL Program Management 2012-09-07 04:58:15 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 13 Ademar Reis 2013-06-04 18:05:36 UTC
(In reply to Laura Novich from comment #12)
> While this bug fix probably only needs to be included in the RN, I am
> marking this as docs_scoped ? just to make sure it doesn't need to be
> considered for the Virt. Admin. Guide
> Ademar?

Documentation isn't necessary.

Comment 15 Jincheng Miao 2013-08-20 04:51:55 UTC
# cat /etc/snmp/snmpd.conf 
rwcommunity public
master agentx
trapcommunity public
trap2sink  localhost

# cat /etc/sysconfig/snmptrapd 
OPTIONS="-m ALL -p /var/run/snmptrapd.pid"

# service snmpd restart
Stopping snmpd:                                            [FAILED]
Starting snmpd:                                            [  OK  ]

# service snmptrapd restart
Stopping snmptrapd:                                        [FAILED]
Starting snmptrapd:                                        [  OK  ]

# LIBVIRT_DEFAULT_URI="qemu:///system" valgrind --leak-check=full libvirtMib_subagent -f -L >& tmp.log 2>&1

# cat tmp.log
==18947== Memcheck, a memory error detector
==18947== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==18947== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==18947== Command: libvirtMib_subagent -f -L
NET-SNMP version 5.5 AgentX subagent connected
==18947== HEAP SUMMARY:
==18947==     in use at exit: 143,700 bytes in 1,575 blocks
==18947==   total heap usage: 32,788 allocs, 31,213 frees, 27,425,111 bytes allocated
==18947== LEAK SUMMARY:
==18947==    definitely lost: 0 bytes in 0 blocks
==18947==    indirectly lost: 0 bytes in 0 blocks
==18947==      possibly lost: 0 bytes in 0 blocks
==18947==    still reachable: 143,700 bytes in 1,575 blocks
==18947==         suppressed: 0 bytes in 0 blocks
==18947== Reachable blocks (those to which a pointer was found) are not shown.
==18947== To see them, rerun with: --leak-check=full --show-reachable=yes
==18947== For counts of detected and suppressed errors, rerun with: -v
==18947== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 6)

No memory leak in valgrind report, so I change the status to VERIFIED.

Comment 16 errata-xmlrpc 2013-11-21 21:40:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.