Bug 736580

Summary: snmpd memory leak when AgentX subagent disconnects while processing a request
Product: Red Hat Enterprise Linux 6 Reporter: Karel Srot <ksrot>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dapospis, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
In the previous update, we fixed snmpd crashing when an AgentX subagent disconnected in the middle of processing a requests. The fix was imperfect and left a small memory leak. In this update, this memory leak is fixed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 07:21:36 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:
Attachments:
Description Flags
valgrind output none

Description Karel Srot 2011-09-08 07:24:26 UTC
Created attachment 522051 [details]
valgrind output

Description of problem:

Qa found out that if the AgentX subagent disconnects while processing  a
request, the request then leaks a bit of memory in the master snmpd (approx 44
bytes per such request).

Valgrind report:
==8326==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==8326==    by 0x4C33E6A: netsnmp_create_delegated_cache (agent_handler.c:713)
==8326==    by 0x4C36BC9: agentx_master_handler (master.c:591)
==8326==    by 0x4C3642E: netsnmp_call_handlers (agent_handler.c:440)
==8326==    by 0x4C26710: handle_var_requests (snmp_agent.c:2611)
==8326==    by 0x4C28395: handle_pdu (snmp_agent.c:3407)
==8326==    by 0x4C2A7EF: netsnmp_handle_request (snmp_agent.c:3203)
==8326==    by 0x4C2B2A9: handle_snmp_packet (snmp_agent.c:1929)
==8326==    by 0x6AD6867: _sess_process_packet (snmp_api.c:5604)
==8326==    by 0x6AD71FF: _sess_read (snmp_api.c:6043)
==8326==    by 0x6AD8048: snmp_sess_read2 (snmp_api.c:6075)
==8326==    by 0x6AD810A: snmp_read2 (snmp_api.c:5667)

I assume the AgentX subagents disconnect very rarely and this memory leak
happens only in very exceptional case, so I left the leak there for now, while
working on it upstream. Please reopen the bug if you'r AgentX disconnects often
so the leak might matter.

valgrind output attached.

related to bug 729738

Comment 3 Jan Safranek 2012-02-07 13:58:48 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
In the previous update, we fixed snmpd crashing when an AgentX subagent disconnected in the middle of processing a requests. The fix was imperfect and left a small memory leak. In this update, this memory leak is fixed.

Comment 8 errata-xmlrpc 2012-06-20 07:21:36 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.

http://rhn.redhat.com/errata/RHSA-2012-0876.html