[ 
https://issues.apache.org/jira/browse/ARIES-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15159461#comment-15159461
 ] 

John Ross commented on ARIES-1441:
----------------------------------

This defect goes to the heart of a question that has persisted since the 
subsystems specification and implementation were introduced, namely, exactly 
which bundles fall under the scope of being managed? For these purposes, a 
"managed bundle" will be defined as one whose full life cycle must be 
controlled by the implementation, but particularly with regard to stopping and 
uninstalling. 

Examples of Managed Bundles
(1) Any bundle installed as a consequence of invoking one of the install 
methods on the Subsystem or AriesSubsystem interfaces.
(2) Any bundle installed using the bundle context of a managed bundle. [a]

Examples of Unmanaged Bundles [b]
(1) The region context bundle of the root subsystem. [c]
(2) Any bundle installed using the bundle context of an unmanaged bundle. [d]

While the fix provided here handles the immediate issue, there may yet remain 
inconsistencies between the definition provided here and the actual behavior. 
Finally, uninstalling the implementation bundle without first uninstalling all 
subsystems except root is out of scope [c]. This would result in all of the 
managed bundles as defined here remaining in the framework along with their 
regions.


[a] This includes the region context bundles of all subsystems except root (see 
(1) under Examples of Unmanaged Bundles). It also includes bundles installed 
via the Eclipse Equinox Region API using a region created by the implementation.

[b] Unmanaged bundles may be resolved and started by the implementation.

[c] This exception exists because the region context bundle of the root 
subsystem cannot be uninstalled by the implementation. Similar to the system 
bundle, the specification does not define UNINSTALLING and UNINSTALLED state 
transitions for the root subsystem. Moreover, there is no UNINSTALLING bundle 
event and therefore no way for a bundle to respond to being uninstalled.

[d] This includes bundles installed via the Eclipse Equinox Region API using a 
region not created by the implementation, including the kernel region.

> Subsystem core tries to shutdown the framework when it has a framework 
> dependency like org.osgi.util.tracker
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-1441
>                 URL: https://issues.apache.org/jira/browse/ARIES-1441
>             Project: Aries
>          Issue Type: Bug
>          Components: Subsystem
>    Affects Versions: subsystem-2.0.6, subsystem-2.0.8
>         Environment: karaf 
> pax exam
>            Reporter: Bas
>              Labels: patch, test
>         Attachments: AriesStopSubsystem.java.test.patch, 
> patch-stop-subsystem.patch
>
>
> When performing a shutdown of the subsystem core bundle it tries to stop the 
> framework because there is a org.osgi.util.tracker import package.
> Also in the same situation described above when trying to shutdown the 
> framework by calling stop on bundle 0 it can fail with:
> [org.apache.aries.subsystem.core.internal.StopAction] : An error occurred 
> while stopping resource osgi.identity; osgi.identity="org.eclipse.osgi"; 
> type="osgi.bundle"; version:Version="3.10.0.v20140606-1445"; 
> singleton:="true" of subsystem 
> org.apache.aries.subsystem.core.internal.BasicSubsystem@25760667
> org.osgi.framework.BundleException: Unable to acquire the state change lock 
> for the module: osgi.identity; osgi.identity="org.eclipse.osgi"; 
> type="osgi.bundle"; version:Version="3.10.0.v20140606-1445"; 
> singleton:="true" [id=0] STOPPED [STOPPED] invalid
>       at org.eclipse.osgi.container.Module.lockStateChange(Module.java:329)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.asyncStop(EquinoxBundle.java:151)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.stop(EquinoxBundle.java:272)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.stop(EquinoxBundle.java:277)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.stopBundleResource(StopAction.java:97)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.stopResource(StopAction.java:109)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.run(StopAction.java:67)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.stopSubsystemResource(StopAction.java:135)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.stopResource(StopAction.java:107)
>       at 
> org.apache.aries.subsystem.core.internal.StopAction.run(StopAction.java:67)
>       at 
> org.apache.aries.subsystem.core.internal.Activator.deactivate(Activator.java:162)
>       at 
> org.apache.aries.subsystem.core.internal.Activator.removedService(Activator.java:291)
>       at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:967)
>       at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:870)
>       at 
> org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
>       at 
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:909)
>       at 
> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
>       at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)
>       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:862)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:222)
>       at 
> org.eclipse.equinox.internal.region.RegionManager.stop(RegionManager.java:67)
>       at 
> org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:827)
>       at 
> org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:820)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:950)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:324)
>       at org.eclipse.osgi.container.Module.doStop(Module.java:626)
>       at org.eclipse.osgi.container.Module.stop(Module.java:488)
>       at 
> org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1623)
>       at 
> org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1542)
>       at 
> org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:248)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:145)
>       at org.eclipse.osgi.container.Module.doStop(Module.java:626)
>       at org.eclipse.osgi.container.Module.stop(Module.java:488)
>       at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:186)
>       at 
> org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:160)
>       at java.lang.Thread.run(Thread.java:662)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to