[SNMP4J] NPEs from SNMP4J 1.9.2 -- socket.close() on a null Socket

Jeff Gehlbach jeffg at jeffg.org
Mon Jun 23 23:09:20 CEST 2008


Since updating OpenNMS to use SNMP4J 1.9.2, we've noticed that we get  
periodic NullPointerExceptions like the following:

Exception in thread "DefaultUDPTransportMapping_192.168.1.1/0"
java.lang.NullPointerException
       at
org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(Unknown
Source)
       at java.lang.Thread.run(Thread.java:595)
       at
org.snmp4j.util.DefaultThreadFactory$WorkerThread.run(Unknown Source)

An alert colleague noticed last week that the synchronized block at  
the end of DefaultUdpTransportMapping$ListenThread.run() had a chance  
to be reached with this.socket == null.  I tried putting an if  
(socket != null) around the close() method call, and that eliminated  
the NPEs on my system.  I've asked one of our customers who is seeing  
far more NPEs than I am to see whether an SNMP4J JAR with the same  
change applied entirely eliminates the NPEs on his system as well.

Frank, could you roll the above conditional into your next round of  
fixes?

Thanks as always for your hard work,
-jeff



More information about the SNMP4J mailing list