[
https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16965637#comment-16965637
]
Jean-Baptiste Onofré edited comment on KARAF-6074 at 11/3/19 10:08 AM:
-----------------------------------------------------------------------
Come on ;)
I provided a workaround to you related to the startup.
You are right with startup order, but I talked about the deployer. If the
deployer is startup before the actual service backend (like features service),
it's not yet useful.
About the startup properties, it can be large that's try, but in that case
features service is useless. It's what we do in the static distribution for
instance.
Startup properties is exactly the same as providing the bundles to the
framework directly.
If you have a patch, I would be happy to review it.
was (Author: jbonofre):
Come on ;)
I provided a workaround to you related to the startup. If the startup is large,
then why features ?
If you have a patch, I would be happy to review it.
> Race condition between the FeaturesService and FeatureDeploymentListener
> ------------------------------------------------------------------------
>
> Key: KARAF-6074
> URL: https://issues.apache.org/jira/browse/KARAF-6074
> Project: Karaf
> Issue Type: Bug
> Components: karaf
> Affects Versions: 4.2.2, 4.2.4
> Environment: Karaf 4.2.2 Windows 7 and Equinox
> Reporter: J. Brébec
> Assignee: Grzegorz Grzybek
> Priority: Critical
>
> On the first start of a custom Karaf container (4.2.2), the logs shows a log
> of NPE in FeatureDeploymentListener.
> After some analysis of this Exception, it's look like a race condition
> between the FeaturesService and the FeatureDeploymentListener :
> # The FeaturesService starts and launch a provisioning in another thread
> # a FeatureDeploymentListener is registered, and call bundleChanged for
> every bundle installed (the startup bundles)
> # It calls FeaturesService.state.requirements and get an empty map
> # Updating the root regions in the requirements map fails with an NPE
> # Some times later, the deployment task launched at step 1 is started, and
> FeaturesService.saveState() is called : state.requirements."root region" is
> initialised
> The step 5 is executed in another thread, so it can happens before step 2
> (and it works) or after, causing this NPE
> Moreover, some methods in FeaturesService assume that
> state.requirements."root region" exists. There are probably others npe here.
>
> {code:java}
> 14:37:55.668 ERROR [activator-1-thread-2] Unable to update deployed features
> for bundle: org.eclipse.osgi - 3.12.100.v20180210-1608
> java.lang.NullPointerException: null
> at
> org.apache.karaf.deployer.features.FeatureDeploymentListener.bundleChanged(FeatureDeploymentListener.java:247)
> [25:org.apache.karaf.deployer.features:4.2.2]
> at
> org.apache.karaf.deployer.features.FeatureDeploymentListener.init(FeatureDeploymentListener.java:95)
> [25:org.apache.karaf.deployer.features:4.2.2]
> at
> org.apache.karaf.deployer.features.osgi.Activator.doStart(Activator.java:52)
> [25:org.apache.karaf.deployer.features:4.2.2]
> at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:292)
> [25:org.apache.karaf.deployer.features:4.2.2]
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> [?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:?]{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)