I've encountered a couple of situations that result in threads hanging inside the amq broker. I'm not 100% certain what the clients are calling but what is happening inside the broker is roughly this:

1. org.apache.activemq.broker.region.Queue or Topic created. This is supplied a MessageStore in the constructor, which is supplied by the DestinationFactoryImpl which gets it from the persistence adapter. The persistence adapter tracks and caches the message stores. (DestinationFactoryImpl.createDestination, lines 80 and 94)

2. After a while the Queue or Topic is removed. All traces are removed from the AbstractRegion and the associated MessageStore is stopped. However the message store is not removed from the persistence adapter.

3. Another Queue or Topic with the same name is created. This is supplied with the stopped message store from the persistence adapter. As part of startup/setup flush() is called which hangs on the countdown latch that waits for disk writes to finish.... since the message store is stopped, attempts to wake up the async write task return immediately.

I don't know the best way to fix this problem.  Some possibilities:

1. When a Queue/Topic is stopped, don't stop the message store. This appears to avoid the hanging problem but the persistence adapter may eventually get full of unused message stores (well, it does now too, but they might all be stopped).

2. When a Queue/Topic is stopped, remove the message store from the persistence adapter.

3. ???

Any ideas?

thanks
david jencks



Reply via email to