Shutdown problem with Master-Slave setup in Karaf/Osgi environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Shutdown problem with Master-Slave setup in Karaf/Osgi environment

Martin Lichtin
When running multiple brokers in master-slave(s) mode (KahaDB file), they behave as described:

- The first broker grabs the exclusive lock on the file and becomes the master broker.

- If that broker dies and releases the lock then another broker takes over.
- The slave brokers sit in a loop trying to grab the lock from the master broker.

This is all great, however at shutdown time there is an issue in that the slave brokers
can potentially be still in the call to start(). The starting thread stack looks like:

at java.util.concurrent.TimeUnit.sleep(TimeUnit.java:386)
at org.apache.activemq.store.SharedFileLocker.doStart(SharedFileLocker.java:83)
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
at org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:94)
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:674)
at org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:658)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:622)
at org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:140)

The Karaf shutdown thread then calls ActiveMQServiceFactory.destroy().
This method and ActiveMQServiceFactory.updated() are synchronized, so things come to a halt.

JIRA https://issues.apache.org/jira/browse/AMQ-6601

Hoping anyone may have a workaround?

- Martin
Loading...