From: SourceForge.net <no...@so...> - 2011-05-25 21:10:36
|
Patches item #3290705, was opened at 2011-04-20 18:42 Message generated for change (Settings changed) made by hardaker You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3290705&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None >Priority: 4 Private: No Submitted By: Daniel Ng () Assigned to: Nobody/Anonymous (nobody) Summary: Eradicates file handle leak during HUPs Initial Comment: I have noticed that the handling of the Target Address Table ( see snmpTargetAddrTable_create()) and Target Parameters Table (see snmpTargetParamTable_create()) during a HUP is not actually done if callbacks are enabled. For example, init_snmpTargetAddrEntry() should register a callback for the SNMPD_CALLBACK_PRE_UPDATE_CONFIG to handle the shutdown of the Target Address Table. This is how it is currently done for the Notificaitons Table via: snmp_register_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_PRE_UPDATE_CONFIG, notifyTable_unregister_notifications, NULL); The result of this incomplete handling of HUP for the Target Address and Target Parameters Tables is: -sockets which are created for each trap sink are never closed (thus causing File Handle leaks) -the data structures related to these Tables are never freed (thus causing memory leaks) Here's a patch for v5.6. It stops the leaking of file handles, but there is still a memory leak (about 500 bytes per HUP are leaked). The memory leak was always present- it was uncovered by the patch, not introduced by it. A crash was worked around by commenting out a free() in snmp_transport.c. Not ideal, but if you have any better suggestions I'd love to know! ---------------------------------------------------------------------- Comment By: Wes Hardaker (hardaker) Date: 2011-05-25 14:07 Message: Well, unfortunately commenting out the free is definitely not the right solution. Do you have a back-trace for when it's crashing? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3290705&group_id=12694 |