activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <>
Subject [jira] Commented: (AMQ-2051) Removing a Destination with active subscribers causes the destination to be unable to be removed.
Date Tue, 13 Jan 2009 19:54:59 GMT


David Jencks commented on AMQ-2051:

This doesn't seem to be a complete fix.  AFAICT the subscriptions still have the references
to any messages that were in the queue when it was destroyed.  Trying to recreate the queue
results in recovery failures as these references don't find the messages they refer to.

I have to say I'm confused about what should happen when you destroyDestination for a destination
that has active consumers and messages in it.  In the case I am working with the consumer
was discarded without being closed so it doesn't much matter what state the client end of
the consumer is in but I wonder what should happen if the consumer is actually being used.

> Removing a Destination with active subscribers causes the destination to be unable to
be removed.
> -------------------------------------------------------------------------------------------------
>                 Key: AMQ-2051
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.1.0, 5.2.0
>            Reporter: Timothy Bish
>            Assignee: Gary Tully
>            Priority: Minor
>             Fix For: 5.3.0
>         Attachments: removeDestinationPatch.txt,
> While attempting to implement destination removal in the ActiveMQ-CPP client I noticed
that when attempting to remove destination that had active subscribers the destination would
be placed in a state that they could not be removed once the subscribers had all been removed.
> Sending a DestinationInfo command to the Broker while keeping my consumer open results
in an exception which is expected since there are still subscribers.  
> {noformat}
> javax.jms.JMSException: Destination still has an active subscription: topic://TEST.FOO
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at org.apache.activemq.advisory.AdvisoryBroker.removeDestinationInfo(
> 	at
> 	at
> 	at
> 	at org.apache.activemq.command.DestinationInfo.visit(
> 	at
> 	at$1.onCommand(
> 	at org.apache.activemq.transport.ResponseCorrelator.onCommand(
> 	at org.apache.activemq.transport.TransportFilter.onCommand(
> 	at org.apache.activemq.transport.vm.VMTransport.iterate(
> 	at org.apache.activemq.thread.PooledTaskRunner.runTask(
> 	at org.apache.activemq.thread.PooledTaskRunner$
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> 	at java.util.concurrent.ThreadPoolExecutor$
> 	at
> {noformat}
> Once I removed my consumer and sent the command again I got no errors indicating that
it couldn't be removed, however I could still see the Destination in the Web Console.
> Looking into the Broker code I see that the RegionBroker class processes a removeDestination
call by first removing the Destination from its map of Destinations and then attempting to
remove it from the Region that it belongs to.  If this call fails the code will never again
attempt to remove a Destination since its removed from the RegionBroker's map but it may not
be removed from the specific region it resides in.  The code looks like it should first attempt
to remove the Destination from the region before removing from its map, the addDestination
method works in that way, adding it to region before adding it to its map so that if an exception
occurs nothing is added.
> : around line 283
> {noformat|
>     public void removeDestination(ConnectionContext context, ActiveMQDestination destination,
long timeout) throws Exception {
>         if (destinations.remove(destination) != null) {
>             switch (destination.getDestinationType()) {
>             case ActiveMQDestination.QUEUE_TYPE:
>                 queueRegion.removeDestination(context, destination, timeout);
>                 break;
>             case ActiveMQDestination.TOPIC_TYPE:
>                 topicRegion.removeDestination(context, destination, timeout);
>                 break;
>             case ActiveMQDestination.TEMP_QUEUE_TYPE:
>                 tempQueueRegion.removeDestination(context, destination, timeout);
>                 break;
>             case ActiveMQDestination.TEMP_TOPIC_TYPE:
>                 tempTopicRegion.removeDestination(context, destination, timeout);
>                 break;
>             default:
>                 throw createUnknownDestinationTypeException(destination);
>             }
>         }
>     }
> {noformat}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message