[SNMP4J] TcpTransportMapping.close(address) hanging in AIX

Brice Fines bfines at sermepa.es
Thu Oct 15 14:06:06 CEST 2009


Hi,

The following code works under Windows but hangs under AIX (when sending 
the same command to the same client).
(code without the finally block has been tested and works perfectly under 
both OS)

try{
//blablabla
final ResponseEvent responseEvent = snmp.send(pdu, target);
//blablabla
}
catch(blablabla){
//blablabla
}
finally {
                if (transportMapping instanceof TcpTransportMapping) {
                        try {
                                ((TcpTransportMapping) 
transportMapping).close(target
                                                .getAddress());
                        } catch (IOException exception) {
                                exception.printStackTrace();
                        }
                }
        }


*******************************************************************************************************************************************************
The traces under Windows are:
*******************************************************************************************************************************************************
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O org.snmp4j.mp.MPv3 
<prepareDataElements> MPv3 finished
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O org.snmp4j.mp.MPv3 
<prepareDataElements> MPv3 finished
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O org.snmp4j.Snmp 
<processPdu> Looking up pending request with handle PduHandle[1708690329]
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O org.snmp4j.Snmp 
<processPdu> Looking up pending request with handle PduHandle[1708690329]
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O org.snmp4j.Snmp 
<send> Removed pending request with handle: PduHandle[1708690329]
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O org.snmp4j.Snmp 
<send> Removed pending request with handle: PduHandle[1708690329]
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Closing socket for 
peer address 10.2.2.127/161
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Closing socket for 
peer address 10.2.2.127/161
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <run> Key is 
readable
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <run> Key is 
readable
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Socket to 
10.2.2.127/161 closed
[13/10/09 11:38:44:362 CEST] 00000031 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Socket to 
10.2.2.127/161 closed
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <run> Key is 
reading
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <run> Key is 
reading
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <readMessage> 
Read channel not open, no bytes read from 10.2.2.127/161
[13/10/09 11:38:44:362 CEST] 00000033 SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread <readMessage> 
Read channel not open, no bytes read from 10.2.2.127/161

*******************************************************************************************************************************************************
The traces under AIX are:
*******************************************************************************************************************************************************

[10/13/09 11:30:55:317 CEST] 0000002f SystemOut     O org.snmp4j.mp.MPv3 
<prepareDataElements> MPv3 finished
[10/13/09 11:30:55:317 CEST] 0000002f SystemOut     O org.snmp4j.mp.MPv3 
<prepareDataElements> MPv3 finished
[10/13/09 11:30:55:319 CEST] 0000002f SystemOut     O org.snmp4j.Snmp 
<processPdu> Looking up pending request with handle PduHandle[674774238]
[10/13/09 11:30:55:319 CEST] 0000002f SystemOut     O org.snmp4j.Snmp 
<processPdu> Looking up pending request with handle PduHandle[674774238]
[10/13/09 11:30:55:327 CEST] 0000002c SystemOut     O org.snmp4j.Snmp 
<send> Removed pending request with handle: PduHandle[674774238]
[10/13/09 11:30:55:328 CEST] 0000002c SystemOut     O org.snmp4j.Snmp 
<send> Removed pending request with handle: PduHandle[674774238]
[10/13/09 11:30:55:347 CEST] 0000002c SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Closing socket for 
peer address 10.2.2.127/161
[10/13/09 11:30:55:347 CEST] 0000002c SystemOut     O 
org.snmp4j.transport.DefaultTcpTransportMapping <close> Closing socket for 
peer address 10.2.2.127/161
*******************************************************************************************************************************************************


In AIX, the application hang at this point.
As I stated in my previous answer, with the last snapshot fixes in 
DefaultTCPTransportMapping, I do no need to manually close my TCP 
connection anymore. But I report this problem to help to determine if it 
is a SNMP4J bug or not under AIX, and to help to solve it trying snapshots 
if you think it is a SNMP4J bug.

Regards


More information about the SNMP4J mailing list