Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-6350

[AMQP0-10] Original connection exception lost if Broker closes socket before client

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.31
    • Component/s: JMS AMQP 0-x
    • Labels:
      None

      Description

      If the JMS Client client encounters an exception whilst interacting with the Broker and the Broker shuts down the its socket before the client, the original cause of the exception is lost.

      We see this happen sporadically new test SSLTest#testSSLConnectionToPlainPortRejected on slow CI boxes.

      Error Message
      
      Unexpected exception message : Error creating connection: Connection reset
      Stacktrace
      
      junit.framework.AssertionFailedError: Unexpected exception message : Error creating connection: Connection reset
      	at junit.framework.Assert.fail(Assert.java:57)
      	at junit.framework.Assert.assertTrue(Assert.java:22)
      	at junit.framework.TestCase.assertTrue(TestCase.java:192)
      	at org.apache.qpid.client.ssl.SSLTest.testSSLConnectionToPlainPortRejected(SSLTest.java:116)
      

      From the logs, it can be seen that the original (useful) cause of the connection failure is being overwritten, and the less useful "connection reset" being returned to the application.

      15-01-29 10:36:08,372 ERROR [IoReceiver - localhost/127.0.0.1:15672] (ssl.SSLReceiver) - Error caught in SSLReceiver
      javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
      	at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:171)
      	at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:845)
      	at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
      	at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
      	at org.apache.qpid.transport.network.security.ssl.SSLReceiver.received(SSLReceiver.java:103)
      	at org.apache.qpid.transport.network.security.ssl.SSLReceiver.received(SSLReceiver.java:36)
      	at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:161)
      	at java.lang.Thread.run(Thread.java:745)
      2015-01-29 10:36:08,373 DEBUG [IoReceiver - localhost/127.0.0.1:15672] (transport.Connection) - exception: Error in SSLReceiver: Unrecognized SSL message, plaintext connection? state : OPENING
      2015-01-29 10:36:08,373 DEBUG [main] (ssl.SSLSender) - Closing SSL connection
      2015-01-29 10:36:08,373 DEBUG [IoReceiver - localhost/127.0.0.1:15672] (transport.Connection) - exception: Connection reset state : OPENING
      2015-01-29 10:36:08,373 DEBUG [IoReceiver - localhost/127.0.0.1:15672] (transport.Connection) - connection closed: conn:af88469
      2015-01-29 10:36:08,373 INFO  [main] (client.AMQConnection) - Unable to connect to broker at tcp://localhost:15672?ssl='true'
      org.apache.qpid.AMQException: Cannot connect to broker: Connection reset [error code 200: reply success]
      	at org.apache.qpid.client.AMQConnectionDelegate_0_10.makeBrokerConnection(AMQConnectionDelegate_0_10.java:241)
      	at org.apache.qpid.client.AMQConnection.makeBrokerConnection(AMQConnection.java:645)
      	at org.apache.qpid.client.AMQConnection.<init>(AMQConnection.java:425)
      	at org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:158)
      	at org.apache.qpid.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:137)
      	at org.apache.qpid.test.utils.QpidBrokerTestCase.getConnection(QpidBrokerTestCase.java:907)
      	at org.apache.qpid.client.ssl.SSLTest.testSSLConnectionToPlainPortRejected(SSLTest.java:110)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at junit.framework.TestCase.runTest(TestCase.java:176)
      	at junit.framework.TestCase.runBare(TestCase.java:141)
      	at org.apache.qpid.test.utils.QpidBrokerTestCase.runBare(QpidBrokerTestCase.java:272)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at org.apache.qpid.test.utils.QpidTestCase.run(QpidTestCase.java:148)
      	at junit.framework.TestSuite.runTest(TestSuite.java:255)
      	at junit.framework.TestSuite.run(TestSuite.java:250)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
      Caused by: org.apache.qpid.transport.ConnectionException: Connection reset
      	at org.apache.qpid.transport.Connection.close(Connection.java:670)
      	at org.apache.qpid.transport.Connection.close(Connection.java:616)
      	at org.apache.qpid.transport.Connection.connect(Connection.java:273)
      	at org.apache.qpid.client.AMQConnectionDelegate_0_10.makeBrokerConnection(AMQConnectionDelegate_0_10.java:221)
      	... 27 more
      Caused by: org.apache.qpid.transport.ConnectionException: Connection reset
      	at org.apache.qpid.transport.Connection.exception(Connection.java:564)
      	at org.apache.qpid.transport.network.Assembler.exception(Assembler.java:107)
      	at org.apache.qpid.transport.network.InputHandler.exception(InputHandler.java:209)
      	at org.apache.qpid.transport.network.security.ssl.SSLReceiver.exception(SSLReceiver.java:72)
      	at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:217)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.net.SocketException: Connection reset
      	at java.net.SocketInputStream.read(SocketInputStream.java:196)
      	at java.net.SocketInputStream.read(SocketInputStream.java:122)
      	at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:156)
      	... 1 more
      2015-01-29 10:36:08,374 DEBUG [main] (jms.FailoverPolicy) - All failover methods exhausted
      

      The 0-10 transport class Connecton should be change to keep the first exception and log any subsequent errors.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                orudyy Alex Rudyy
                Reporter:
                kwall Keith Wall
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: