[SNMP4J] Why 'stop' on SocketException in DefaultUdpTransportMapping.ListenThread?

Smith, Gary gary.smith at visualnetworksystems.com
Mon Jul 11 16:29:13 CEST 2011


Folks

I'm using SNMP4j 1.11.3 and get occasional socket exceptions from certain devices, but not all.

Current DefaultUdpTransportMapping.ListenThread.run() behaviour is to stop listening if any SocketException is caught (line 394).

This kills the listener thread for every device, not  just the offending device.

I have a badly behaved/config'ed device that is provoking an exception:

Socket for transport mapping org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread at 1264c84 error: socket closed
java.net.SocketException: socket closed
       at java.net.PlainDatagramSocketImpl.receive0(Native Method)
       at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
       at java.net.DatagramSocket.receive(DatagramSocket.java:712)
       at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:619)


This effectively kills the ListenThread for all my polled devices - by removing the "stop = true;" line above, my application becomes resilient (although obviously I have some config problems).


Thanks


Gary



More information about the SNMP4J mailing list