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

java.net.SocketException: Connection closed by remote host thrown during ActiveMQConnection#close()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Information Provided
    • 5.16.0
    • None
    • JMS client
    • None

    Description

      When I connect and disconnect from a broker using the activemq-client, sometimes I get the exception below. ssl:// is used. The exception appears when the client is disconnecting.

      The broker in this case is the current snapshot of ActiveMQ Artemis.

      Good test for reproducing is org.apache.activemq.artemis.tests.integration.security.SecurityTest#testJAASSecurityManagerAuthenticationWithCertsAndOpenWire.

      I saw it in conjunction with the flush() exception from Netty, discussed on ARTEMIS-1804. It turns out the flush{} exception is probably unrelated to this one, because it appeared in the server log every time and seems harmless.

      The exception below appears on the client in about 1 % of runs of the aforementioned tests (so it must be run in a loop to see this happen). For some reason, this error appears to me more often on Travis CI (linked from the Artemis bug)

      The exception is

      javax.jms.JMSException: Connection closed by remote host
      	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
      	at org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1310)
      	at org.apache.activemq.ActiveMQConnection.close(ActiveMQConnection.java:696)
      	at com.redhat.mqe.lib.CoreClient.close(CoreClient.java:302)
      	at com.redhat.mqe.lib.CoreClient.closeConnObjects(CoreClient.java:295)
      	at com.redhat.mqe.lib.SenderClient.startClient(SenderClient.java:156)
      	at com.redhat.mqe.lib.Main.main(Main.java:50)
      	at com.redhat.mqe.aoc.Main.main(Main.java:74)
      	at AocMainTest.main(MainTest.kt:113)
      	at AbstractMainTest$sendSingleMessageAllTrustingTls$1.invoke(AbstractMainTest.kt:404)
      	at AbstractMainTest$sendSingleMessageAllTrustingTls$1.invoke(AbstractMainTest.kt:75)
      	at AbstractMainTestKt.assertNoSystemExit(AbstractMainTest.kt:66)
      	at AbstractMainTest.sendSingleMessageAllTrustingTls(AbstractMainTest.kt:398)
      	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:436)
      	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
      	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
      	at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
      	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
      	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
      	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:112)
      	at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
      	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      	at java.util.Iterator.forEachRemaining(Iterator.java:116)
      	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
      	at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
      	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      	at java.util.Iterator.forEachRemaining(Iterator.java:116)
      	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
      	at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
      	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
      	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
      	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
      	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
      	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:67)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: java.net.SocketException: Connection closed by remote host
      	at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1565)
      	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:124)
      	at org.apache.activemq.transport.tcp.TcpBufferedOutputStream.flush(TcpBufferedOutputStream.java:115)
      	at java.io.DataOutputStream.flush(DataOutputStream.java:123)
      	at org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:194)
      	at org.apache.activemq.transport.AbstractInactivityMonitor.doOnewaySend(AbstractInactivityMonitor.java:335)
      	at org.apache.activemq.transport.AbstractInactivityMonitor.oneway(AbstractInactivityMonitor.java:317)
      	at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:94)
      	at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:116)
      	at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
      	at org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
      	at org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1308)
      	... 64 more
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jdanek Jiri Daněk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: