rajith77 / qpid

Mirror of Apache Qpid
0 stars 0 forks source link

Closing connection raises TransportException #1

Closed pmoravec closed 11 years ago

pmoravec commented 11 years ago

I.e. try it with code:

try {
    connection = new ConnectionImpl("amqp://guest:guest@localhost:5672/test?brokerlist='tcp://localhost:5672'");
    connection.start();
    connection.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

and you get:

2013-08-28 07:52:08,633 DEBUG IoReceiver - localhost/127.0.0.1:5672 -2013-08-28 07:52:08.563 - connection closed: conn:6513cf0 org.apache.qpid.transport.ConnectionException: connection-failed at org.apache.qpid.transport.Connection.close(Connection.java:619) at org.apache.qpid.transport.Connection.close(Connection.java:593) at org.apache.qpid.amqp_0_10.jms.impl.ConnectionImpl.closeImpl(ConnectionImpl.java:595) at org.apache.qpid.amqp_0_10.jms.impl.ConnectionImpl.close(ConnectionImpl.java:213) at Connection_openClose.(Connection_openClose.java:20) at Connection_openClose.main(Connection_openClose.java:12) Caused by: org.apache.qpid.transport.TransportFailureException: connection-failed at org.apache.qpid.transport.ClientConnection.exception(ClientConnection.java:139) at org.apache.qpid.transport.network.Assembler.exception(Assembler.java:107) at org.apache.qpid.transport.network.InputHandler.exception(InputHandler.java:199) at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:233) at java.lang.Thread.run(Thread.java:679) Caused by: org.apache.qpid.transport.TransportException: connection-failed ... 2 more 2013-08-28 07:52:08,636 WARN IoReceiver - localhost/127.0.0.1:5672 -2013-08-28 07:52:08.563 - Connection already marked as closed. No failover is attempted.

This is caused by common/src/main/java/org/apache/qpid/transport/network/io/IoReceiver.java:232

    finally
    {
        if (read == -1 && !exceptionNotified)
        {
            receiver.exception(new TransportException("connection-failed"));
        }

where "yes-branch" of the if-statement is executed every-time (when no exception has been raised few lines above).

rajith77 commented 11 years ago

This is fixed with the commit 3e3099e8da9eb1625216a2de20a68ee4b569949c