[SNMP4J] TcpTransportMapping.close(address) hanging in AIX
Frank Fock
fock at agentpp.com
Fri Oct 16 01:19:16 CEST 2009
Hi Brice,
I am wondering why the most of the log messages appear
twice. Apparently, the request is sent twice and then
also the close(..) is called twice. This should not
impose any problem.
You may implement your own ThreadFactory that uses
a predefined timeout when WorkerTask.join() is
executed on a task. Then you will be able to test
if the join() that is executed on behalf of
DefaultTcpTransportMapping causes the hang.
You can set the ThreadFactory to be used by SNMP4J
before you create the transport mappings by
SNMP4JSettings.setThreadFactory(..)
Regards,
Frank
Brice Fines wrote:
> 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
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list