[ 
https://issues.apache.org/jira/browse/FELIX-6241?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tom Watson resolved FELIX-6241.
-------------------------------
    Fix Version/s: scr-2.1.18
         Assignee: Tom Watson
       Resolution: Fixed

> IllegalStateException can be thrown from listener if BundleContext is invalid
> -----------------------------------------------------------------------------
>
>                 Key: FELIX-6241
>                 URL: https://issues.apache.org/jira/browse/FELIX-6241
>             Project: Felix
>          Issue Type: Improvement
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.1.16
>            Reporter: Tom Watson
>            Assignee: Tom Watson
>            Priority: Major
>             Fix For: scr-2.1.18
>
>
> If a bundle is stopped on one thread and SCR service listener is responding 
> to service events on another thread it is possible to see the following 
> exception get fired as a FrameworkEvent Error:
>  
> {{FrameworkEvent ERROR java.lang.IllegalStateException: BundleContext is no 
> longer valid}}
> {{    at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:1055)}}
> {{    at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.ungetService(BundleContextImpl.java:726)}}
> {{    at 
> org.apache.felix.scr.impl.manager.SingleRefPair.ungetServiceObjects(SingleRefPair.java:72)}}
> {{    at 
> org.apache.felix.scr.impl.manager.DependencyManager$AbstractCustomizer.ungetService(DependencyManager.java:226)}}
> {{    at 
> org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(DependencyManager.java:399)}}
> {{    at 
> org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(DependencyManager.java:294)}}
> {{    at 
> org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1242)}}
> {{    at 
> org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1137)}}
> {{    at 
> org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.untrack(ServiceTracker.java:997)}}
> {{    at 
> org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1176)}}
> {{    at 
> org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:125)}}
> {{    at 
> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113)}}
> {{    at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985)}}
> {{    at 
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)}}
> {{    at 
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)}}
> {{    at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:896)}}
> {{    at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:834)}}
> {{    at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:227)}}
>  
> The IllegalStateException should be caught here and ignored when trying to 
> unget a service.  A similar IllegalStateException is caught and ignored when 
> using ServiceObjects with 
> {{org.apache.felix.scr.impl.manager.AbstractPrototypeRefPair.doUngetService(ScrComponentContext,
>  T)}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to