[ https://issues.apache.org/jira/browse/FELIX-3345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Jencks resolved FELIX-3345. --------------------------------- Resolution: Fixed Fix Version/s: scr-1.6.2 The relevant patches were all applied well before 1.6.2 was released > Concurrency problems in SCR > --------------------------- > > Key: FELIX-3345 > URL: https://issues.apache.org/jira/browse/FELIX-3345 > Project: Felix > Issue Type: Bug > Components: Declarative Services (SCR) > Affects Versions: scr-1.6.0 > Reporter: David Jencks > Assignee: Felix Meschberger > Fix For: scr-1.6.2 > > Attachments: FELIX-3345-2.diff, FELIX-3345-3.diff, FELIX-3345-4.diff, > FELIX-3345-5.diff, FELIX-3345.diff > > > We've been encountering several exceptions thrown intermittently from DS. > They generally look like ungetting service on a disposed-of SCR > BundleComponentActivator, ComponentManager, or DependencyManager. There may > be two threads trying to shut down the same bundles at the same time. I'm > not sure how to investigate the root cause or if this kind of behavior is > expected. The SCR code generally doesn't look very thread safe. It's easy > to "fix" the specific problems we see by adding more checks to the SCR code > so the NPEs are avoided, or attempted use of closed bundle contexts are > caught and ignored. I'd be happy to keep looking into this but could use > some hints about what should be happening. Unless someone can come up with a > better explanation and fix it would be great meanwhile to patch the code to > avoid throwing the exceptions. > Here are some of the typical stack traces we see: > Stack Dump = org.osgi.framework.ServiceException: Exception in > org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService() > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:287) > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.releaseService(ServiceRegistrationImpl.java:562) > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.releaseServicesInUse(ServiceRegistry.java:665) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.close(BundleContextImpl.java:91) > at > org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:514) > at > org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:565) > at > org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1161) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:595) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215) > at > org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284) > at > org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:691) > at > org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:598) > at > org.eclipse.osgi.framework.internal.core.InternalSystemBundle$1.run(InternalSystemBundle.java:261) > at java.lang.Thread.run(Thread.java:680) > Caused by: java.lang.NullPointerException > at > org.apache.felix.scr.impl.BundleComponentActivator.log(BundleComponentActivator.java:614) > at > org.apache.felix.scr.impl.BundleComponentActivator.log(BundleComponentActivator.java:589) > at > org.apache.felix.scr.impl.manager.AbstractComponentManager.log(AbstractComponentManager.java:633) > at > org.apache.felix.scr.impl.manager.AbstractComponentManager$State.log(AbstractComponentManager.java:1000) > at > org.apache.felix.scr.impl.manager.AbstractComponentManager$State.ungetService(AbstractComponentManager.java:964) > at > org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService(DelayedComponentManager.java:114) > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse$3.run(ServiceUse.java:277) > at java.security.AccessController.doPrivileged(Native Method) > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:275) > ... 14 more > Stack Dump = org.osgi.framework.ServiceException: Exception in > org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService() > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:287) > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.releaseService(ServiceRegistrationImpl.java:562) > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:245) > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.unregisterServices(ServiceRegistry.java:635) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.close(BundleContextImpl.java:88) > at > org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:514) > at > org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:565) > at > org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1161) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:595) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215) > at > org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:284) > at > org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:691) > at > org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:598) > at > org.eclipse.osgi.framework.internal.core.InternalSystemBundle$1.run(InternalSystemBundle.java:261) > at java.lang.Thread.run(Thread.java:680) > Caused by: java.lang.IllegalStateException: BundleContext is no longer valid > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.ungetService(BundleContextImpl.java:634) > at > org.apache.felix.scr.impl.manager.DependencyManager.ungetService(DependencyManager.java:819) > at > org.apache.felix.scr.impl.manager.DependencyManager.unbind(DependencyManager.java:1000) > at > org.apache.felix.scr.impl.manager.DependencyManager.close(DependencyManager.java:880) > at > org.apache.felix.scr.impl.manager.ImmediateComponentManager.disposeImplementationObject(ImmediateComponentManager.java:268) > at > org.apache.felix.scr.impl.manager.ImmediateComponentManager.deleteComponent(ImmediateComponentManager.java:135) > at > org.apache.felix.scr.impl.manager.DelayedComponentManager.deleteComponent(DelayedComponentManager.java:67) > at > org.apache.felix.scr.impl.manager.AbstractComponentManager$Active.ungetService(AbstractComponentManager.java:1266) > at > org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService(DelayedComponentManager.java:114) > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse$3.run(ServiceUse.java:277) > at java.security.AccessController.doPrivileged(Native Method) > at > org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:275) > ... 15 more > ------- > This one is from FELIX-3307: > java.lang.NullPointerException > at > org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1028) > > at > org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:308) > > at > org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:170) > > at > org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104) > > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) > > at > org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) > > at > org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) > > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) > > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771) > > at > org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) > > 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.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451) > > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:950) > -- 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