Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-1873

AMQ222068: STOMP heartbeat handler is not stopped after StompConnection.destroy()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 2.6.1, 2.7.0
    • STOMP
    • None
    • Patch

    Description

      StompConnection.java (it's in artemis-stomp-protocol) utilizes a VersionedStompFrameHandler frame handler which in the case of STOMP 1.1 and 1.2 contains a heartbeat scheduler.

      This scheduler is stopped when StompConnection.fail() is called but not for StompConnection.destroy(). So in some cases you may get dangling heartbeat threads from destroyed connections. These threads simply try to send heartbeats to dead clients resulting in following warnings:
       

      2018-05-17 17:01:06,591 WARN  [org.apache.activemq.artemis.core.protocol.stomp] (Thread-22 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$3@6b9ec8e5)) AMQ222068: connection closed org.apache.activemq.artemis.core.protocol.stomp.StompConnection@5d5327f9

       
      In my opinion it's just a simple oversight. From what I see ARTEMIS-934 did only fix the issue for StompConnection.fail(). But RemoteConnections (which is StompConnection) can also be destroy()'ed.

      Here's example diff that may fix it:

      diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
      index fbd010775..4c11108c3 100644
      --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
      +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
      @@ -335,9 +335,10 @@ public final class StompConnection implements RemotingConnection {
                if (destroyed) {
                   return;
                }
      +
      +         destroyed = true;
             }
      
      -      destroyed = true;
      
             internalClose();
      
      @@ -351,6 +352,10 @@ public final class StompConnection implements RemotingConnection {
          }
      
          private void internalClose() {
      +      if (frameHandler != null) {
      +         frameHandler.disconnect();
      +      }
      +
             transportConnection.close();
      
             manager.cleanup(this);
      @@ -372,9 +377,6 @@ public final class StompConnection implements RemotingConnection {
      
             ActiveMQServerLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType());
      
      -      if (frameHandler != null) {
      -         frameHandler.disconnect();
      -      }
      
             // Then call the listeners
             callFailureListeners(me);
      
      

      Attachments

        Issue Links

          Activity

            People

              jbertram Justin Bertram
              pputerla Paweł Puterla
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: