Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-8304

org.apache.activemq.transport.tcp.TcpTransport.run() attempts to read from closed stream

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.16.2
    • 5.16.3, 5.17.0
    • None
    • None

    Description

      Our problem is as follows:

      We have an application which stops broker on its exit using org.apache.activemq.broker.BrokerService.stop() call.

      The above stop call stops TransportConnection(s), and in the middle of stopping, org.apache.activemq.transport.tcp.TcpTransport.run() is attempting to read from  closed stream, which is causing following exceptions in our application logs:

      ================

      connectionErrorOccurred called with null
      javax.jms.JMSException: java.io.EOFException
      at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)
      at org.apache.activemq.ActiveMQConnection.onAsyncException(ActiveMQConnection.java:1960)
      at org.apache.activemq.ActiveMQConnection.onException(ActiveMQConnection.java:1979)
      at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:114)
      at org.apache.activemq.transport.ResponseCorrelator.onException(ResponseCorrelator.java:126)
      at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:114)
      at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:114)
      at org.apache.activemq.transport.WireFormatNegotiator.onException(WireFormatNegotiator.java:173)
      at org.apache.activemq.transport.AbstractInactivityMonitor.onException(AbstractInactivityMonitor.java:345)
      at org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:96)
      at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:219)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.io.EOFException: null
      at java.base/java.io.DataInputStream.readInt(DataInputStream.java:397)
      at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:268)
      at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:240)
      at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:232)
      at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)

      ================

       

      It seems we need to check for !isStopping() as well at following location:

      https://github.com/apache/activemq/blob/activemq-5.16.x/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java#L214

      It seems, we have done the same at https://github.com/apache/activemq/blob/activemq-5.16.x/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java#L330

       

       

       

       

      Attachments

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            sdurga Sekhar Durga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h