[
https://issues.apache.org/jira/browse/ARIES-1277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bas updated ARIES-1277:
-----------------------
Description:
When using a parent-child subsystem setup, the lifecycle of a bundle is not
respected according to the osgi spec. when trying to load a class from a bundle
the BundleActivator is not being called before returning the class in the
following scenario.
When I create the following environment where I create a subsystem parent
'parent1' which is a feature that has a subsystem constituent 'child1'
(application subsystem) and a bundle 'parent-bundle1'. The child subsystem is
an application subsystem and has a bundle 'child-bundle1'.
So subsystem 'parent1' contains 'child1' and 'parent-bundle1'.
Subsystem 'child1' contains 'child-bundle1'.
The 'child-bundle1' tries to use a class from 'parent-bundle1' that should
fetch state that is set in the BundleActivator of 'parent-bundle1'. Sometimes
the logs indicated a nullpointerexception occurred while starting
'child-bundle1'.
While further analysing the problem it became clear to me it was possible to
load a class while the bundle activator has not been executed. I added some
logging to the code to confirm in the log what I suspected and the log
confirmed my suspicions. I was also able to force the issue by using
'start-order' in the manifest to make sure subsystem 'child1' would start
before 'parent-bundle1'. Before that I had to try 20x times before it randomly
occurred.
If I read the Osgi spec correctly it says the BundleActivator.start should
finish before a class from that bundle is returned. I didn't find anything in
the subsystem spec that describes a different flow when using subsystems.
I would expect 'parent-bundle1' to be started and become active at the point
where 'child-bundle1' tries to load a class from 'parent-bundle1'.
What happens now is 'parent-bundle1' is not being activated but the class is
returned causing a nullpointerexception when the state is queried. At the point
where 'parent1' is trying to start bundle 'parent-bundle1' it succeeds as you
would expect.
was:
When using a parent-child subsystem setup, the lifecycle of a bundle is not
respected according to the osgi spec. when trying to load a class from a bundle
the BundleActivator is not being called before returning the class in the
following scenario.
When I create the following environment where I create a subsystem parent
'parent1' which is a feature that has a subsystem constituent 'child1'
(application subsystem) and a bundle 'parent-bundle1'. The child subsystem is
an application subsystem and has a bundle 'child-bundle1'.
So subsystem 'parent1' contains 'child1' and 'parent-bundle1'.
Subsystem 'child1' contains 'child-bundle1'.
The 'child-bundle1' tries to use a class from 'parent-bundle1' that should
fetch state that is set in the BundleActivator of 'parent-bundle1'. Sometimes
the logs indicated a nullpointerexception occurred while starting
'parent-bundle1'.
While further analysing the problem it became clear to me it was possible to
load a class while the bundle activator has not been executed. I added some
logging to the code to confirm in the log what I suspected and the log
confirmed my suspicions. I was also able to force the issue by using
'start-order' in the manifest to make sure 'child1' would load before
'parent-bundle1'. Before that I had to try 20x times before it randomly
occurred.
If I read the Osgi spec correctly it says the BundleActivator.start should
finish before a class from that bundle is returned. I didn't find anything in
the subsystem spec that describes a different flow when using subsystems.
I would expect 'parent-bundle1' to be started and become active at the point
where 'child-bundle1' tries to load a class from 'parent-bundle1'.
What happens is 'parent-bundle1' is not being activated but the class is
returned causing a nullpointerexception when the state is queried. At the point
where 'parent1' is trying to start bundle 'parent-bundle1' it succeeds as you
would expect.
> the lifecycle of a bundle is not respected according to the osgi spec. when
> trying to load a class from a bundle
> ----------------------------------------------------------------------------------------------------------------
>
> Key: ARIES-1277
> URL: https://issues.apache.org/jira/browse/ARIES-1277
> Project: Aries
> Issue Type: Bug
> Components: Subsystem
> Affects Versions: subsystem-core-1.0.0
> Environment: Karaf version 3.0.1
> org.eclipse.osgi - 3.8.2.v20130124-134944
> Java Virtual Machine Java HotSpot(TM) 64-Bit Server VM version
> 24.55-b03
> Version 1.7.0_55
> Reporter: Bas
>
> When using a parent-child subsystem setup, the lifecycle of a bundle is not
> respected according to the osgi spec. when trying to load a class from a
> bundle the BundleActivator is not being called before returning the class in
> the following scenario.
> When I create the following environment where I create a subsystem parent
> 'parent1' which is a feature that has a subsystem constituent 'child1'
> (application subsystem) and a bundle 'parent-bundle1'. The child subsystem is
> an application subsystem and has a bundle 'child-bundle1'.
> So subsystem 'parent1' contains 'child1' and 'parent-bundle1'.
> Subsystem 'child1' contains 'child-bundle1'.
> The 'child-bundle1' tries to use a class from 'parent-bundle1' that should
> fetch state that is set in the BundleActivator of 'parent-bundle1'. Sometimes
> the logs indicated a nullpointerexception occurred while starting
> 'child-bundle1'.
> While further analysing the problem it became clear to me it was possible to
> load a class while the bundle activator has not been executed. I added some
> logging to the code to confirm in the log what I suspected and the log
> confirmed my suspicions. I was also able to force the issue by using
> 'start-order' in the manifest to make sure subsystem 'child1' would start
> before 'parent-bundle1'. Before that I had to try 20x times before it
> randomly occurred.
> If I read the Osgi spec correctly it says the BundleActivator.start should
> finish before a class from that bundle is returned. I didn't find anything in
> the subsystem spec that describes a different flow when using subsystems.
> I would expect 'parent-bundle1' to be started and become active at the point
> where 'child-bundle1' tries to load a class from 'parent-bundle1'.
> What happens now is 'parent-bundle1' is not being activated but the class is
> returned causing a nullpointerexception when the state is queried. At the
> point where 'parent1' is trying to start bundle 'parent-bundle1' it succeeds
> as you would expect.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)