Occasional deadlock in Gemini Blueprint Extender Threads

328 views Asked by At

I am occasionally running into deadlock issue when starting my osgi application. My project has following external dependencies (does NOT contain my project specific bundles):

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.8.2.v20130124-134944
1   ACTIVE      com.google.gson_2.1.0.v201203072145
2   ACTIVE      org.eclipse.equinox.console_1.0.100.v20121001-124408
3   ACTIVE      org.apache.felix.gogo.shell_0.10.0.v201211091412
4   ACTIVE      org.apache.felix.gogo.runtime_0.10.0.v201209301036
5   ACTIVE      org.apache.felix.gogo.command_0.10.0.v201209301215
6   ACTIVE      org.apache.felix.configadmin_1.6.0
7   ACTIVE      org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
                Fragments=23
8   ACTIVE      org.apache.felix.eventadmin_1.3.2
9   ACTIVE      org.apache.felix.fileinstall_3.2.6
12  ACTIVE      com.springsource.edu.emory.mathcs.backport_3.1.0
13  ACTIVE      org.eclipse.gemini.blueprint.core_1.0.2.RELEASE

14  ACTIVE      org.springframework.beans_3.2.2.RELEASE
16  ACTIVE      org.apache.felix.http.jetty_2.2.0

17  ACTIVE      org.eclipse.gemini.blueprint.extender_1.0.2.RELEASE

19  ACTIVE      org.eclipse.gemini.blueprint.io_1.0.2.RELEASE

20  ACTIVE      org.springframework.context_3.2.2.RELEASE

24  ACTIVE      org.springframework.expression_3.2.2.RELEASE

26  ACTIVE      org.springframework.core_3.2.2.RELEASE
28  ACTIVE      org.apache.felix.http.whiteboard_2.2.0
29  ACTIVE      org.eclipse.orbit.mongodb_2.7.3.v20120213-1927
30  ACTIVE      org.springframework.context.support_3.2.2.RELEASE
31  ACTIVE      com.springsource.org.apache.commons.logging_1.1.1

32  ACTIVE      org.springframework.aop_3.2.2.RELEASE
34  ACTIVE      com.springsource.org.aopalliance_1.0.0

The thread dump of my application is as follows :

Found one Java-level deadlock:

"Gogo shell":
  waiting to lock monitor 7fe00d8b58d8 (object 7ad401900, a org.eclipse.osgi.internal.serviceregistry.ServiceRegistry),
  which is held by "EclipseGeminiBlueprintExtenderThread-24"
"EclipseGeminiBlueprintExtenderThread-24":
  waiting to lock monitor 7fe00c078660 (object 7ad35bae8, a org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader),
  which is held by "EclipseGeminiBlueprintExtenderThread-12"
"EclipseGeminiBlueprintExtenderThread-12":
  waiting to lock monitor 7fe00d8b58d8 (object 7ad401900, a org.eclipse.osgi.internal.serviceregistry.ServiceRegistry),
  which is held by "EclipseGeminiBlueprintExtenderThread-24"

Java stack information for the threads listed above:

"Gogo shell":
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.lookupServiceRegistrations(ServiceRegistry.java:953)
    - waiting to lock <7ad401900> (a org.eclipse.osgi.internal.serviceregistry.ServiceRegistry)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1217)
    at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
    at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:88)
    at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
    at java.lang.Thread.run(Thread.java:680)
"EclipseGeminiBlueprintExtenderThread-24":
    at org.eclipse.gemini.blueprint.util.internal.MapBasedDictionary.keys(MapBasedDictionary.java:183)
    at org.eclipse.osgi.internal.serviceregistry.ServiceProperties.<init>(ServiceProperties.java:37)
    - locked <7a922b678> (a org.eclipse.gemini.blueprint.util.internal.MapBasedDictionary)
    at org.eclipse.osgi.internal.serviceregistry.ServiceProperties.<init>(ServiceProperties.java:57)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.createProperties(ServiceRegistrationImpl.java:294)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:121)
    - locked <7a922b928> (a java.lang.Object)
    - locked <7ad401900> (a org.eclipse.osgi.internal.serviceregistry.ServiceRegistry)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
    at org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext.publishContextAsOsgiServiceIfNecessary(AbstractOsgiBundleApplicationContext.java:361)
    at org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:223)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:328)
    - locked <7ad7ef180> (a java.lang.Object)
    at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
    at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
    at java.lang.Thread.run(Thread.java:680)
"EclipseGeminiBlueprintExtenderThread-12":
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.lookupServiceRegistrations(ServiceRegistry.java:953)
    - waiting to lock <7ad401900> (a org.eclipse.osgi.internal.serviceregistry.ServiceRegistry)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1217)
    at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
    at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2475)
    at java.lang.Class.getMethod0(Class.java:2718)
    at java.lang.Class.getMethod(Class.java:1630)
    at java.lang.Class.getEnumConstantsShared(Class.java:2982)
    at java.lang.Class.enumConstantDirectory(Class.java:3011)
    at java.lang.Enum.valueOf(Enum.java:191)
    at org.eclipse.gemini.blueprint.config.internal.ServiceBeanDefinitionParser$ServiceAttributeCallback.process(ServiceBeanDefinitionParser.java:75)
    at org.eclipse.gemini.blueprint.config.internal.util.ParserUtils.parseAttributes(ParserUtils.java:65)
    at org.eclipse.gemini.blueprint.config.internal.util.ParserUtils.parseCustomAttributes(ParserUtils.java:93)
    at org.eclipse.gemini.blueprint.config.internal.ServiceBeanDefinitionParser.parseAttributes(ServiceBeanDefinitionParser.java:200)
    at org.eclipse.gemini.blueprint.config.internal.ServiceBeanDefinitionParser.doParse(ServiceBeanDefinitionParser.java:132)
    at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
    at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
    at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170)
    at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:60)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:242)
    - locked <7ae07c8b8> (a java.lang.Object)
    at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220)
    at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224)
    at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157)
    at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:211)
    at java.lang.Thread.run(Thread.java:680)

Found 1 deadlock.

The threads EclipseGeminiBlueprintExtenderThread-24 and EclipseGeminiBlueprintExtenderThread-12 are deadlocked and Gogo shell is involved somehow.

My question is what is causing this deadlock? - is it something in my code or it's a bug in gemini? How do I fix this issue? Any pointers will he highly appreciated.

0

There are 0 answers