[SNMP4J] Bug report: org.snmp4j.MessageException: Socket is closed

linhui (F) linhui3 at huawei.com
Wed May 4 05:12:15 CEST 2016


Hi,
In our code, we use Snmp Object to send a trap. The question is : while running for some time (may be a week) in Windows platform, there will occur exception while sending trap.

The Exception stack is :
         org.snmp4j.MessageException: Socket is closed
         at org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:485)
         at org.snmp4j.Snmp.sendMessage(Snmp.java:1082)
         at org.snmp4j.Snmp.send(Snmp.java:882)
         at org.snmp4j.Snmp.send(Snmp.java:875)
         ...

I have checked the source, The closed socket is DefaultUdpTransportMapping's DatagramSocket.

Another messages:

(1)     Before running the sending-trap thread, we use listen() function to listen the IP and port which is the same as sending-trap IP and port.
For example, the IP is 10.66.92.233 and port is 6666, we listen 10.66.92.233/6666 and use 10.66.92.233/6666 to send a trap.


(2)     SNMP4j's version is 1.11.2


At the beginning of the thread running, there are no exceptions occur. And I don't know why this exception occur.

Somebody can help me and explains this?

Best regards,
Lin Hui



More information about the SNMP4J mailing list