[SNMP4J] NullPointerException when closing DefaultUDPTransportMapping
Frank Fock
fock at agentpp.com
Wed May 26 01:13:17 CEST 2010
Hi,
Thanks for reporting this bug.
The following code applied to lines 403-405 and in the close() method
at lines 140-142 should fix it:
DatagramSocket closingSocket = socket;
if ((closingSocket != null) && (!closingSocket.isClosed())) {
closingSocket.close();
}
Best regards,
Frank
On 24.05.2010 17:17, Andy Coulbeck wrote:
> It looks like there is a race condition in snmp4j-1.11 DefaultUDPTransportMapping when closing the SNMP client session. Occasionally we see the following error.
>
> 'An uncaught exception during processing for thread DefaultUDPTransportMapping_10.5.1.82/0 has caused it to terminate abnormally. The stack trace for that exception is: java.lang.NullPointerException#0A org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:404)#0A java.lang.Thread.run(Thread.java:619)
>
> The value of 'socket' could be set to null between lines 403 and 404 (presumably by the thread that is in the close method).
>
> 403: if (socket != null) {
> 404: socket.close();
> 405: }
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list