Sekhar Durga created AMQ-8304: --------------------------------- Summary: org.apache.activemq.transport.tcp.TcpTransport.run() attempts to read on closed stream Key: AMQ-8304 URL: https://issues.apache.org/jira/browse/AMQ-8304 Project: ActiveMQ Issue Type: Bug Affects Versions: 5.16.2 Reporter: Sekhar Durga
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] -- This message was sent by Atlassian Jira (v8.3.4#803005)