Timeout on DefaultTCPTransportMapping

hi… we are seeing a strange behaviour on snmp4j 2.6.3 where the logs claim the socket wasn’t used in 2 minutes, even though it was used a minute ago
2021-10-13 12:16:27,454 DEBUG DefaultTcpTransportMapping - Looking up connection for destination ‘ip’ returned: SocketEntry[peerAddress=ip,socket=Socket[addr=/ip,port=162,localport=57458],lastUse=Fri Jul 31 18:56:37 CDT 1970,readBufferPosition=-1,socketTimeout=org.snmp4j.transport.DefaultTcpTransportMapping$SocketTimeout@f6783fc]

and then later

2021-10-13 12:16:28,021 DEBUG DefaultTcpTransportMapping - Socket has not been used for 120000 milliseconds, closing it
2021-10-13 12:16:28,021 INFO DefaultTcpTransportMapping - Socket to ip/162 closed due to timeout
2021-10-13 12:16:28,117 DEBUG DefaultTcpTransportMapping - Scheduling 60005

is this some form of bug, or race condition?

I recommend upgrading to SNMP4J 2.8.6 because there were several socket leaks fixed. See

This scenario could indicate a leaked socket that was not removed when it actually should have been removed.

thanks, is this a drop in replacement? as i understand log4j was removed in 2.8.2.

Yes, you can re-add the Log4j support by adding the maven dependency to the snmp4j-log4j package.