[SNMP4J] resource leak on failed connect in AgentXSubagent.connect()
Sachs, Larry
lsachs at c-cor.com
Thu Mar 15 00:19:32 CET 2007
Hi,
The newly released snmp-agentx 1.0 fixes much of the resource leak on a
failed connect. I still believe there is a small hole. I recommend the
following in AgentXSubagent.connect()...
--- AgentXSubagent.java
***************
*** 229,248 ****
--- 229,249 ----
int status = AgentXProtocol.AGENTX_TIMEOUT;
try {
status = openSession(transport, masterAddress, session);
if (status != AgentXProtocol.AGENTX_TIMEOUT) {
peers.put(masterAddress, peer);
LOGGER.info("Added new peer
address="+masterAddress+",peer="+peer);
}
}
catch (IOException ex) {
LOGGER.error(ex);
+ removeMaster(transport);
return AgentXProtocol.AGENTX_ERROR;
}
if (status == AgentXProtocol.AGENTX_SUCCESS) {
sessions.put(new Integer(session.getSessionID()), session);
LOGGER.info("Opened subagent session successfully: "+session);
}
else {
removeMaster(transport);
}
return status;
Thanks,
ls
More information about the SNMP4J
mailing list