[ https://issues.apache.org/jira/browse/AMQ-3675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish resolved AMQ-3675. ------------------------------- Resolution: Fixed Fix Version/s: 5.6.0 Assignee: Timothy Bish Cleaned up the test to remove the need for the activemq-web dependency and sleep calls, and added some additional checks. Applied suggested fix, thanks. > 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 > Assignee: Timothy Bish > Priority: Minor > Labels: DurableSubscriptions, Topic > Fix For: 5.6.0 > > Attachments: CountConsumersAfterSubscriptionRemoval.java, > TopicRegion.AMQ-3675.patch.txt > > > - 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