Gavin Scott created ARIES-924:
---------------------------------
Summary: Deadlock in transaction wrappers BundleActivator
Key: ARIES-924
URL: https://issues.apache.org/jira/browse/ARIES-924
Project: Aries
Issue Type: Bug
Components: Transaction
Affects Versions: 0.3
Reporter: Gavin Scott
There is a deadlock condition in org.apache.aries.transaction.jdbc.Activator.
It is possible for start() and serviceChanged() to both call open() on the
Activator's ServiceTracker such that the start() thread has acquired the
transaction.wrappers bundle lock and needs to acquire the ServiceTracker's
monitor, and the serviceChanged() thread holds the ServiceTracker's monitor and
needs to acquire the transaction.wrappers bundle lock. We are seeing this
particularly when running pax exam tests on our integration test server.
Simply synchronizing all of the Activator's methods seems like a reasonable fix.
Sample stack traces are:
"Thread-6" daemon prio=10 tid=0x00007f97e80b7800 nid=0x1a7c waiting for monitor
entry [0x00007f97fd1f2000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:299)
- waiting to lock <0x00000000c4c06558> (a
org.osgi.util.tracker.ServiceTracker)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
at org.apache.aries.transaction.jdbc.Activator.start(Activator.java:58)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:914)
at
org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:353)
at
org.apache.karaf.features.internal.FeaturesServiceImpl$1.run(FeaturesServiceImpl.java:988)
"CM Configuration Updater (ManagedService Update:
pid=org.apache.aries.transaction)" daemon prio=10 tid=0x00007f97e407d800
nid=0x1a5a in Object.wait() [0x00007f9818324000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000000c403c2e8> (a [Ljava.lang.Object;)
at java.lang.Object.wait(Object.java:503)
at org.apache.felix.framework.Felix.acquireBundleLock(Felix.java:4922)
- locked <0x00000000c403c2e8> (a [Ljava.lang.Object;)
at org.apache.felix.framework.Felix.addServiceListener(Felix.java:2814)
at
org.apache.felix.framework.BundleContextImpl.addServiceListener(BundleContextImpl.java:246)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:308)
- locked <0x00000000c4c34e48> (a
org.osgi.util.tracker.ServiceTracker$Tracked)
- locked <0x00000000c4c06558> (a org.osgi.util.tracker.ServiceTracker)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
at
org.apache.aries.transaction.jdbc.Activator.serviceChanged(Activator.java:118)
at
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
at
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3890)
at org.apache.felix.framework.Felix.access$000(Felix.java:79)
at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:728)
at
org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
at org.apache.felix.framework.Felix.registerService(Felix.java:2979)
at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:313)
at
org.apache.aries.transaction.TransactionManagerService.start(TransactionManagerService.java:157)
at org.apache.aries.transaction.Activator.updated(Activator.java:63)
- locked <0x00000000c4be3b90> (a
org.apache.aries.transaction.Activator)
at
org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1160)
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:104)
at java.lang.Thread.run(Thread.java:722)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira