You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2009/03/04 22:23:56 UTC
[jira] Created: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Exception thrown in ServiceTracker at shutdown
-----------------------------------------------
Key: FELIX-971
URL: https://issues.apache.org/jira/browse/FELIX-971
Project: Felix
Issue Type: Bug
Components: Framework
Reporter: Guillaume Nodet
Priority: Minor
ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
java.lang.IllegalStateException: Invalid BundleContext.
at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
at org.apache.felix.framework.Felix.access$000(Felix.java:39)
at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678949#action_12678949 ]
Richard S. Hall commented on FELIX-971:
---------------------------------------
It looks like ServiceTracker.close() was not called. When we stop a bundle, we unregister all services, release any used services, and unregister any events listeners for the bundle. This is the order that the spec says they should be done. However, it appears like it might be the case that since the listeners are removed last, that the unclosed ServiceTracker sees events after its context is invalid. Can you verify if the ServiceTracker is closed and if not, try to close it and see if it goes away?
> Exception thrown in ServiceTracker at shutdown
> -----------------------------------------------
>
> Key: FELIX-971
> URL: https://issues.apache.org/jira/browse/FELIX-971
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Reporter: Guillaume Nodet
> Priority: Minor
>
> ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
> java.lang.IllegalStateException: Invalid BundleContext.
> at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
> at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
> at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
> at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
> at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
> at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
> at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
> at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
> at org.apache.felix.framework.Felix.access$000(Felix.java:39)
> at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
> at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
> at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
> at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
> at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
> at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680220#action_12680220 ]
Richard S. Hall commented on FELIX-971:
---------------------------------------
I wonder if it would be ok for us to avoid sending events to bundles with an invalid context.
> Exception thrown in ServiceTracker at shutdown
> -----------------------------------------------
>
> Key: FELIX-971
> URL: https://issues.apache.org/jira/browse/FELIX-971
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Reporter: Guillaume Nodet
> Priority: Minor
>
> ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
> java.lang.IllegalStateException: Invalid BundleContext.
> at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
> at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
> at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
> at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
> at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
> at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
> at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
> at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
> at org.apache.felix.framework.Felix.access$000(Felix.java:39)
> at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
> at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
> at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
> at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
> at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
> at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard S. Hall resolved FELIX-971.
-----------------------------------
Resolution: Fixed
Fix Version/s: felix-1.6.0
Assignee: Richard S. Hall
After thinking about this some more, I decided to move bundle context invalidation after all bundle shutdown tasks. The reason I decided to do this, is because there is no way we can guarantee a bundle cannot receive events between the time its BundleActivator.stop() method returns and until we invalidate its context, so it makes sense to keep the context valid until the bundle can no longer receive events.
Further, the spec can be interpreted this way, since it says the context should be valid while the bundle is STARTING, ACTIVE, and STOPPING. A bundle is STOPPING during all of the bundle shutdown tasks, so this implies the context should be valid during this.
Guillaume, could you see if your example works with out exceptions now? If so, please close this issue. Thanks.
> Exception thrown in ServiceTracker at shutdown
> -----------------------------------------------
>
> Key: FELIX-971
> URL: https://issues.apache.org/jira/browse/FELIX-971
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Reporter: Guillaume Nodet
> Assignee: Richard S. Hall
> Priority: Minor
> Fix For: felix-1.6.0
>
>
> ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
> java.lang.IllegalStateException: Invalid BundleContext.
> at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
> at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
> at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
> at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
> at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
> at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
> at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
> at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
> at org.apache.felix.framework.Felix.access$000(Felix.java:39)
> at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
> at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
> at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
> at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
> at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
> at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680223#action_12680223 ]
Richard S. Hall commented on FELIX-971:
---------------------------------------
Or should we invalidate the bundle context after removing listeners?
> Exception thrown in ServiceTracker at shutdown
> -----------------------------------------------
>
> Key: FELIX-971
> URL: https://issues.apache.org/jira/browse/FELIX-971
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Reporter: Guillaume Nodet
> Priority: Minor
>
> ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
> java.lang.IllegalStateException: Invalid BundleContext.
> at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
> at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
> at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
> at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
> at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
> at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
> at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
> at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
> at org.apache.felix.framework.Felix.access$000(Felix.java:39)
> at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
> at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
> at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
> at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
> at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
> at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (FELIX-971) Exception thrown in ServiceTracker at
shutdown
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet closed FELIX-971.
---------------------------------
> Exception thrown in ServiceTracker at shutdown
> -----------------------------------------------
>
> Key: FELIX-971
> URL: https://issues.apache.org/jira/browse/FELIX-971
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Reporter: Guillaume Nodet
> Assignee: Richard S. Hall
> Priority: Minor
> Fix For: felix-1.6.0
>
>
> ERROR: EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
> java.lang.IllegalStateException: Invalid BundleContext.
> at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
> at org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362)
> at org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429)
> at org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126)
> at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957)
> at org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809)
> at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678)
> at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379)
> at org.apache.felix.framework.Felix.access$000(Felix.java:39)
> at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620)
> at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571)
> at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105)
> at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120)
> at org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146)
> at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815)
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
> at java.lang.Thread.run(Thread.java:613)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.