[SNMP4J] Possible concurrency bug in snmp4j ?
Frank Fock
fock at agentpp.com
Mon Feb 12 19:44:55 CET 2018
Hi Elhanan,
Please upgrade to SNMP4J 2.5.11 to fix this issue.
Best regards
Frank
> Am 12.02.2018 um 18:05 schrieb Maayan, Elhanan <Elhanan.Maayan at sbdinc.com>:
>
> Hi..i'm using snm4j 2.4.3.
>
> Is it possible that just when snmp4j closes a connection (due to timeout, or remote closing) and it's trying to addRegistration causing to throw an exception, is it possible that snmp4j can no longer establish connection?
>
>
>
> Below is a small log of a sample client I'm doing , which does interval every 5 seconds, furthermore it's target.setTimeout is also set to 5 seconds, to emulate the bug (which actually happens upon remote close)
>
> You can see that subsequent attempts simply try to connect but don't' send anything..
>
>
>
> Mon Feb 12 18:10:37 IST 2018 Sending message
>
> Looking up connection for destination '192.168.97.21/162' returned: SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[addr=qa-mv-0640.corp.aeroscout.com/192.168.97.21,port=162,localport=51072],lastUse=Mon Mar 09 04:30:03 IST 1970,readBufferPosition=-1]
>
> {192.168.97.21/162=SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[addr=qa-mv-0640.corp.aeroscout.com/192.168.97.21,port=162,localport=51072],lastUse=Mon Mar 09 04:30:03 IST 1970,readBufferPosition=-1]}
>
> Waking up selector for new message
>
> Socket has not been used for 10002 milliseconds, closing it
>
> Socket to 192.168.97.21/162 closed due to timeout
>
> Adding operation 8 for: SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[unconnected],lastUse=Mon Mar 09 04:30:13 IST 1970,readBufferPosition=-1]
>
> java.nio.channels.ClosedChannelException
>
> Firing transport state event: org.snmp4j.transport.TransportStateEvent[source=org.snmp4j.transport.DefaultTcpTransportMapping at 1d6c6de8,peerAddress=192.168.97.21/162,newState=4,cancelled=false,causingException=java.nio.channels.ClosedChannelException]
>
> State changed to Closed Peer address 192.168.97.21/162
>
> Exception in thread "DefaultTCPTransportMapping_192.168.60.80/0" java.lang.RuntimeException: java.nio.channels.ClosedChannelException
>
> at org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread.processPending(DefaultTcpTransportMapping.java:697)
>
> at org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread.run(DefaultTcpTransportMapping.java:893)
>
> at java.lang.Thread.run(Thread.java:745)
>
> Caused by: java.nio.channels.ClosedChannelException
>
> at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:197)
>
> at org.snmp4j.transport.DefaultTcpTransportMapping$SocketEntry.addRegistration(DefaultTcpTransportMapping.java:433)
>
> at org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread.processPending(DefaultTcpTransportMapping.java:658)
>
> ... 2 more
>
> Mon Feb 12 18:10:47 IST 2018 Sending message
>
> Looking up connection for destination '192.168.97.21/162' returned: null
>
> {}
>
> Socket for address '192.168.97.21/162' is closed, opening it...
>
> Trying to connect to 192.168.97.21/162
>
> Mon Feb 12 18:10:57 IST 2018 Sending message
>
> Looking up connection for destination '192.168.97.21/162' returned: SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[unconnected],lastUse=Mon Mar 09 04:30:23 IST 1970,readBufferPosition=-1]
>
> {192.168.97.21/162=SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[unconnected],lastUse=Mon Mar 09 04:30:23 IST 1970,readBufferPosition=-1]}
>
> Socket for address '192.168.97.21/162' is closed, opening it...
>
> Trying to connect to 192.168.97.21/162
>
> Mon Feb 12 18:11:07 IST 2018 Sending message
>
> Looking up connection for destination '192.168.97.21/162' returned: SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[unconnected],lastUse=Mon Mar 09 04:30:33 IST 1970,readBufferPosition=-1]
>
> {192.168.97.21/162=SocketEntry[peerAddress=192.168.97.21/162,socket=Socket[unconnected],lastUse=Mon Mar 09 04:30:33 IST 1970,readBufferPosition=-1]}
>
> Socket for address '192.168.97.21/162' is closed, opening it...
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j
More information about the SNMP4J
mailing list