[ https://issues.apache.org/jira/browse/ARIES-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15159117#comment-15159117 ]
John Ross commented on ARIES-1441: ---------------------------------- Starting the subsystem is necessary for the following reason. When the subsystems implementation bundle is stopped, a deactivation occurs. As part of the deactivation, the root subsystem is stopped. As part of stopping the root subsystem, the child subsystem is stopped. Because the child subsystem references the bundle providing the necessary package, the bundle is stopped, The issue does not occur if the subsystem is not started because (1) there is no child subsystem to stop, and (2) protection against stopping unmanaged bundles is already provided by line 147 of StartAction when stopping the root subsystem. > 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)