[SNMP4J] Still unsolved: NullPointerException when closing DefaultUDPTransportMapping

Tosoni jp.tosoni at acksys.fr
Mon Aug 30 19:18:00 CEST 2010


Hi all,

I think there is still a race condition when closing
DefaultUDPTransportMapping.
I think the race condition is when this code:

	142:      closingSocket.close();
	143:    }
	144:    socket = null;

is executed concurrently with:

	334:      while (!stop) {
here->335:        DatagramPacket packet = new DatagramPacket(buf,
buf.length,
here->336:
udpAddress.getInetAddress(),
here->337:
udpAddress.getPort());
here->338:        try {
here->339:          try {
	340:            socket.receive(packet);



In order to produce the problem more frequently, just insert a
"Thread.yield()"
between lines 339 and 340. When the close() happens between the while(!stop)
test and the socket.receive(), the socket is null and throws a
NullPointerException.

Jean-Pierre Tosoni
Acksys R&D dept.


Re:
>     [SNMP4J] NullPointerException when closing DefaultUDPTransportMapping
>     Andy Coulbeck andrew.coulbeck at unboundid.com
>     Mon May 24 17:17:26 CEST 2010
>
> 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.
> 	(snip)




More information about the SNMP4J mailing list