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

Removing a DurableTopicSubscription leaves subscription in active subscriptions map

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.5.1
    • 5.6.0
    • Broker
    • 5.5.1, Mac OS X 10.7.2

    Description

      When removing a durable topic subscription, the subscriptions map is left with the durable subscription on the map. This means that if you were to remove the topic and then recreate the topic, you end up with a continually increasing consumerCount on the Topic. Replication on the Web Admin console is:

      • Create inactive durable subscriber
      • delete the associated topic
      • delete inactive durable subscriber
      • Create inactive durable subscriber

      The topic will now think/show it has 2 subscribers on the destinationStatistics associated with the topic.

      This seems to boil down to an accidental use of identity comparison on the subscriptions map in the method {{public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception }}:

      196  if (subscriptions.get(sub.getConsumerInfo()) != null) {
      197 	 super.removeConsumer(context, sub.getConsumerInfo());
      198  } else {
      199 	// try destroying inactive subscriptions
      200 	destroySubscription(sub);
      201  }
      

      which should be (i think):

      196  if (subscriptions.get(sub.getConsumerInfo().getConsumerId()) != null) {
      197 	 super.removeConsumer(context, sub.getConsumerInfo());
      198  } else {
      199 	// try destroying inactive subscriptions
      200 	destroySubscription(sub);
      201  }
      

      Subscriptions are added to the map using the getConsumerId(), not the identity of the ConsumerInfo object; elsewhere in the class; hence the suggestion for using getConsumerId()

      Hope that makes sense.
      cheers
      /dom

      Attachments

        1. CountConsumersAfterSubscriptionRemoval.java
          6 kB
          Dominic Tootell
        2. TopicRegion.AMQ-3675.patch.txt
          0.6 kB
          Dominic Tootell

        Activity

          People

            tabish Timothy A. Bish
            dominict Dominic Tootell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: