You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (Commented) (JIRA)" <ji...@apache.org> on 2012/01/23 15:12:41 UTC

[jira] [Commented] (AMQ-3675) Removing a DurableTopicSubscription leaves subscription in active subscriptions map

    [ https://issues.apache.org/jira/browse/AMQ-3675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191166#comment-13191166 ] 

Timothy Bish commented on AMQ-3675:
-----------------------------------

Adding a unit test and supplying a patch would be a good contribution.
                
> Removing a DurableTopicSubscription leaves subscription in active subscriptions map
> -----------------------------------------------------------------------------------
>
>                 Key: AMQ-3675
>                 URL: https://issues.apache.org/jira/browse/AMQ-3675
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.5.1
>         Environment: 5.5.1, Mac OS X 10.7.2
>            Reporter: Dominic Tootell
>            Priority: Minor
>              Labels: DurableSubscriptions, Topic
>
> - Url reference: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java?revision=1160894&view=markup
> 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 }}*:
> {noformat}
> 196  if (subscriptions.get(sub.getConsumerInfo()) != null) {
> 197 	 super.removeConsumer(context, sub.getConsumerInfo());
> 198  } else {
> 199 	// try destroying inactive subscriptions
> 200 	destroySubscription(sub);
> 201  }
> {noformat}
> which should be (i think):
> {noformat}
> 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  }
> {noformat}
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira