[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745424#comment-17745424 ] ASF subversion and git services commented on KARAF-6074: Commit 73431831273b1e3383d9885ac36945126645e011 in karaf's branch refs/heads/karaf-4.3.x from Grzegorz Grzybek [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=7343183127 ] [KARAF-6074] Prevent duplicate PIDs from factory PID defined in feature config (cherry picked from commit f5ee79652dfc3f8d8c25620abce60910b63c55da) > 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: Jean-Baptiste Onofré >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745421#comment-17745421 ] ASF subversion and git services commented on KARAF-6074: Commit f5ee79652dfc3f8d8c25620abce60910b63c55da in karaf's branch refs/heads/main from Grzegorz Grzybek [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=f5ee79652d ] [KARAF-6074] Prevent duplicate PIDs from factory PID defined in feature config > 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: Jean-Baptiste Onofré >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745422#comment-17745422 ] ASF subversion and git services commented on KARAF-6074: Commit ee957b83afbc04487f226794074bfc520a6aade7 in karaf's branch refs/heads/main from JB Onofré [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=ee957b83af ] Merge pull request #1720 from grgrzybek/KARAF-6074 [KARAF-6074] Prevent duplicate PIDs from factory PID defined in featu… > 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: Jean-Baptiste Onofré >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745420#comment-17745420 ] ASF GitHub Bot commented on KARAF-6074: --- jbonofre merged PR #1720: URL: https://github.com/apache/karaf/pull/1720 > 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: Jean-Baptiste Onofré >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728290#comment-17728290 ] Grzegorz Grzybek commented on KARAF-6074: - PR: https://github.com/apache/karaf/pull/1720 > 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 >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728288#comment-17728288 ] ASF GitHub Bot commented on KARAF-6074: --- grgrzybek opened a new pull request, #1720: URL: https://github.com/apache/karaf/pull/1720 …re config > 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 >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728285#comment-17728285 ] Grzegorz Grzybek commented on KARAF-6074: - The {{~}} is something new in Config Admin spec 1.6 (CMPN R7) and is related to new methods in {{org.osgi.service.cm.ConfigurationAdmin}} interface: {code:java} org.osgi.service.cm.ConfigurationAdmin.getFactoryConfiguration(String factoryPid, String name, String location) {code}. Javadoc says: {quote} The PID for this Configuration object is generated from the provided factory PID and the name by starting with the factory PID appending a tilde ('~' \u007E), and then appending the name. {quote} And this is exactly what {{org.apache.felix.cm.impl.ConfigurationAdminImpl#getFactoryConfiguration(java.lang.String, java.lang.String)}} is doing (felix.configadmin 1.9.26: {code:java} final String pid = factoryPid + '~' + name; {code} FactoryPid itself should _not_ contain a dash, although the spec doesn't say anything (?) about it. At least I didn't find anything. felix.fileinstall's {{org.apache.felix.fileinstall.internal.ConfigInstaller#parsePid()}} has: {code:java} String pid = path.substring(0, path.lastIndexOf('.')); int n = pid.indexOf('-'); if (n > 0) { String factoryPid = pid.substring(n + 1); pid = pid.substring(0, n); return new String[] { pid, factoryPid }; } else { return new String[] { pid, null }; } {code} So for: {code:xml} {code} the related configuration file should be {{etc/org.apache.karaf.example.config-abc.cfg}} and felix.fileinstall would create: {code:java} new String[] { "org.apache.karaf.example.config", "abc" } {code} then {{org.apache.felix.fileinstall.internal.ConfigInstaller#getConfiguration()}} would detect ({{pid[1] != null}}) that this new method from cm 1.6 should be called with these parameters {code:java} org.osgi.service.cm.ConfigurationAdmin#getFactoryConfiguration("org.apache.karaf.example.config", "abc", "?") {code} Then pid would be {{org.apache.karaf.example.config~abc}} and if the config is new, this method would be called with these parameters: {code:java} org.apache.felix.cm.impl.ConfigurationManager#createFactoryConfiguration("org.apache.karaf.example.config~abc", "org.apache.karaf.example.config", "?") {code} When config.xml file is dropped to {{deploy/}}, the first relevant method called is {{org.apache.karaf.features.internal.service.FeatureConfigInstaller#installFeatureConfigs()}} - no configadmin or fileinstall is involved yet. * ConfigId#pid is set to {{org.apache.karaf.example.config-abc}} * n == 31 because of {{pid.contains("~") ? pid.indexOf('~') : pid.indexOf('-')}} * ConfigId#isFactoryPid is set to true * ConfigId#factoryPid is set to {{org.apache.karaf.example.config}} * ConfigId#name stays null, because there's no {{~}} and this may be a problem cfgFile is set to {{/data/servers/apache-karaf-4.4.4-SNAPSHOT/etc/org.apache.karaf.example.config-abc.cfg}} (_full_ pid) Because {{ConfigId#name}} is null, {{org.osgi.service.cm.ConfigurationAdmin#createFactoryConfiguration(factoryPid, location)}} is called instead of {{org.osgi.service.cm.ConfigurationAdmin#getFactoryConfiguration(factoryPid, name, location)}}. org.apache.felix.cm.impl.ConfigurationManager#createPid() returns random PID based on factory PID. In my case: {{org.apache.karaf.example.config.11346460-6c07-4dcb-b1e9-8b6e71bda0b9}} in {{org.apache.felix.cm.impl.ConfigurationImpl#ConfigurationImpl()}}: {noformat} this.basePID: {org.apache.felix.cm.impl.helper.TargetedPID@8022} "org.apache.karaf.example.config.11346460-6c07-4dcb-b1e9-8b6e71bda0b9" this.factoryPID = {org.apache.felix.cm.impl.helper.TargetedPID@8023} "org.apache.karaf.example.config" {noformat} {{org.apache.felix.cm.impl.ConfigurationImpl#storeNewConfiguration()}} is not called (because it's factory pid). Karaf's FeatureConfigInstaller continues to operate on: {noformat} cfg = {org.apache.felix.cm.impl.ConfigurationAdapter@8033} "Configuration PID=org.apache.karaf.example.config.11346460-6c07-4dcb-b1e9-8b6e71bda0b9, factoryPID=org.apache.karaf.example.config, bundleLocation=null" configurationAdmin: org.apache.felix.cm.impl.ConfigurationAdminImpl = {org.apache.felix.cm.impl.ConfigurationAdminImpl@7907} delegatee: org.apache.felix.cm.impl.ConfigurationImpl = {org.apache.felix.cm.impl.ConfigurationImpl@8021} "Configuration PID=org.apache.karaf.example.config.11346460-6c07-4dcb-b1e9-8b6e71bda0b9, factoryPID=org.apache.karaf.example.config, bundleLocation=null" baseId: org.apache.felix.cm.impl.helper.TargetedPID = {org.apache.felix.cm.impl.helper.TargetedPID@8022} "org.apache.karaf.example.config.11346460-6c07-4dcb-b1e9-8b6e71bda0b9" configurationManager: org.apache.felix.cm.impl.ConfigurationManager = {org.apache.felix.cm.impl.ConfigurationManager@8017}
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728256#comment-17728256 ] Grzegorz Grzybek commented on KARAF-6074: - Continuing the discussion from https://lists.apache.org/thread/cq4v9x0lf0k6onkghtkjc9gpjnwrj2db cc: [~jbonofre] > 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 >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.20.10#820010)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16965637#comment-16965637 ] Jean-Baptiste Onofré commented on KARAF-6074: - 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 > Fix For: 4.2.3 > > > 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)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16965635#comment-16965635 ] J. Brébec commented on KARAF-6074: -- I can't agree with you. # In OSGI, you should'nt rely on startup order, it's just wrong # The startup.properties has been generated by the maven-karaf-plugin.. If the startup properties should be small, then why this file exists or why there are options to configure the "startup" feature ? I have a working patch for this issue, but I haven't published yet because this component is quite complex, and I not know if it works for all usecases. > 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 > Fix For: 4.2.3 > > > 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)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16965590#comment-16965590 ] Jean-Baptiste Onofré commented on KARAF-6074: - The deployer SHOULD NOT be part of {{startup.properties}} definitely. It's not the case by default, and it's the case for all deployers. As the deployers are depending to other services/features, they have to be installed AFTER the services. So, the {{etc/startup.properties}} is simply wrong in this scenario. Probably a scope mistake in the {{pom.xml}} which added all as startup feature instead of boot feature. > 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 > Fix For: 4.2.3 > > > 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)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16965585#comment-16965585 ] Grzegorz Grzybek commented on KARAF-6074: - IMO, {{mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.features/4.2.4 = 26}} should simply not be part of startup properties... Features service (which _switches_ from {{etc/startup.properties}} to more sophisticated {{etc/org.apache.karaf.features.cfg}}, or in other words simply from Felix to Karaf) should be used for such scenarios. Especially because you're trying to install a bundle that's supposed to install features - it should be installed as feature, not as bundle ;) [~jbonofre] wdyt? > 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 > Fix For: 4.2.3 > > > 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)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809675#comment-16809675 ] Grzegorz Grzybek commented on KARAF-6074: - Ah. So that's the problem... > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809624#comment-16809624 ] J. Brébec commented on KARAF-6074: -- I see. In my custom distribution, the deployer.features is referenced as a startup bundle, in startup.properties. {code} # Bundles to be started on startup, with startlevel mvn\:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.4 = 1 mvn\:org.apache.felix/org.apache.felix.metatype/1.2.2 = 5 mvn\:org.apache.karaf.services/org.apache.karaf.services.eventadmin/4.2.4 = 5 mvn\:org.ops4j.pax.url/pax-url-aether/2.6.1 = 5 mvn\:org.ops4j.pax.url/pax-url-wrap/2.6.1/jar/uber = 5 mvn\:org.fusesource.jansi/jansi/1.17.1 = 8 mvn\:org.ops4j.pax.logging/pax-logging-api/1.10.1 = 8 mvn\:org.ops4j.pax.logging/pax-logging-log4j2/1.10.1 = 8 mvn\:org.apache.felix/org.apache.felix.coordinator/1.0.2 = 9 mvn\:org.apache.felix/org.apache.felix.configadmin/1.9.14 = 10 mvn\:org.apache.felix/org.apache.felix.fileinstall/3.6.4 = 11 mvn\:org.apache.karaf.features/org.apache.karaf.features.core/4.2.4 = 15 mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.1 = 20 mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.3.1 = 20 mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0 = 20 mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.10.1 = 20 mvn\:org.apache.aries.proxy/org.apache.aries.proxy/1.1.4 = 20 mvn\:org.ow2.asm/asm-analysis/7.1 = 20 mvn\:org.ow2.asm/asm-commons/7.1 = 20 mvn\:org.ow2.asm/asm-tree/7.1 = 20 mvn\:org.ow2.asm/asm-util/7.1 = 20 mvn\:org.ow2.asm/asm/7.1 = 20 mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint/4.2.4 = 24 mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.wrap/4.2.4 = 24 mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.features/4.2.4 = 26 mvn\:org.apache.karaf.bundle/org.apache.karaf.bundle.blueprintstate/4.2.4 = 30 mvn\:org.apache.karaf.bundle/org.apache.karaf.bundle.core/4.2.4 = 30 mvn\:org.apache.karaf.config/org.apache.karaf.config.core/4.2.4 = 30 mvn\:org.apache.karaf.diagnostic/org.apache.karaf.diagnostic.boot/4.2.4 = 30 mvn\:org.apache.karaf.diagnostic/org.apache.karaf.diagnostic.core/4.2.4 = 30 mvn\:org.apache.karaf.features/org.apache.karaf.features.command/4.2.4 = 30 mvn\:org.apache.karaf.jaas.blueprint/org.apache.karaf.jaas.blueprint.config/4.2.4 = 30 mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.command/4.2.4 = 30 mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.config/4.2.4 = 30 mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.modules/4.2.4 = 30 mvn\:org.apache.karaf.log/org.apache.karaf.log.core/4.2.4 = 30 mvn\:org.apache.karaf.package/org.apache.karaf.package.core/4.2.4 = 30 mvn\:org.apache.karaf.service/org.apache.karaf.service.core/4.2.4 = 30 mvn\:org.apache.karaf.shell/org.apache.karaf.shell.commands/4.2.4 = 30 mvn\:org.apache.karaf.shell/org.apache.karaf.shell.console/4.2.4 = 30 mvn\:org.apache.karaf.shell/org.apache.karaf.shell.core/4.2.4 = 30 mvn\:org.apache.karaf.shell/org.apache.karaf.shell.ssh/4.2.4 = 30 mvn\:org.apache.karaf.shell/org.apache.karaf.shell.table/4.2.4 = 30 mvn\:org.apache.karaf.system/org.apache.karaf.system.core/4.2.4 = 30 mvn\:org.apache.karaf/org.apache.karaf.event/4.2.4 = 30 mvn\:org.apache.servicemix.bundles/org.apache.servicemix.bundles.not-yet-commons-ssl/0.3.11_1 = 30 mvn\:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0 = 30 mvn\:org.apache.sshd/sshd-core/1.7.0 = 30 mvn\:org.jline/jline-builtins/3.10.0 = 30 mvn\:org.jline/jline-reader/3.10.0 = 30 mvn\:org.jline/jline-terminal-jansi/3.10.0 = 30 mvn\:org.jline/jline-terminal/3.10.0 = 30 {code} I'll defined this in my pom : {code} eventadmin wrap {code} I'll check why my custom distrib generate this. > 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 > Fix For: 4.2.3 > > > 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
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809598#comment-16809598 ] Grzegorz Grzybek commented on KARAF-6074: - Hmm, but see {{org.apache.karaf.deployer.features.osgi.Activator#doStart()}}. It has: {code:java} FeaturesService service = getTrackedService(FeaturesService.class); if (service == null) { return; } {code} So if {{service.registerListener(deploymentListener)}} is called, {{FeaturesService}} is already there. And if it's there it either: * was the one that even installed deployer.features bundle (as declared in {{etc/org.apache.karaf.features.cfg}}) * loaded the state (and root region definition) from bundle data. I again checked with debugger and: * org.ops4j.pax.url.mvn.internal.Activator#registerHandler * org.apache.karaf.features.internal.osgi.Activator#doStart * org.apache.karaf.features.internal.service.FeaturesServiceImpl#loadState * org.apache.karaf.deployer.features.osgi.Activator#doStart * org.apache.karaf.features.internal.service.FeaturesServiceImpl#registerListener(org.apache.karaf.features.DeploymentListener) * org.apache.karaf.deployer.features.osgi.Activator.DeploymentFinishedListener#deploymentEvent were correctly synchronized... > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809582#comment-16809582 ] Grzegorz Grzybek commented on KARAF-6074: - [~j3rem1e] thanks - yes, that's what I was thinking about too. I'll just breakpoint inside pax-url-aether service registration and I should be able to reproduce. > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809580#comment-16809580 ] J. Brébec commented on KARAF-6074: -- You're right, i am wrong with my scenario. You have to take into account another point : Activator in Karaf use "BaseActivator". This implementation declares dependencies in the @Service annotation. In the Activator.start() method, if the dependencies are not met, then the real activation (doStart) is done asynchronously in another thread (and is not blocking) In the case of the FeaturesService (at leat in my custom distribution), randomly, the dependency to the maven URLStreamHandlerService is not resolved in Activator.start() and the FeaturesServiceImpl is instanciated in another thread. this can happen after the feature-deployer bundle is activated. The mvnURLStreamHandlerService is implemented as a ManagedService : the registration waits for the "org.ops4j.pax.url.mvn" configuration to be present, and this configuration is injected by fileinstall in a background thread. If fileinstall is "too slow" and the configuration is injected after the start of the feature-core bundle, then this NPE occurs. > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16809104#comment-16809104 ] Grzegorz Grzybek commented on KARAF-6074: - I have problem with: bq. The activator of the bundle "feature-deployment" is called. Because it won't be called until featuresService will process the "deployer" feature and start deployer.feature bundle... but before it does that, lastDeploymentStatus is no longer the initial DEPLOYMENT_FINISHED... I really put breakpoints everywhere I could... Do you use custom distro? > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16808937#comment-16808937 ] J. Brébec commented on KARAF-6074: -- This issue happen only on the first start, and can happen randomly because it's a race condition between two threads : the thread activating the osgi framework (and calling the activators), and the thread doing the provisioning of features. It happens on the following scenario : # First start # The activator of the bundle feature-core is called. It's not blocking : it spawn a new thread to do the provisioning. the FeaturesService is registered in osgi here # Let's assume the thread created in the previous step can't execute (or is slow), maybe because the hardware have only one core, or whatever reason : the FeaturesServiceImpl.lastDeploymentStatus is DEPLOYMENT_FINISHED. You can simulate this step easily with a debugger, with a break-point in [executor.submit|https://github.com/apache/karaf/blob/karaf-4.2.4/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java#L994] # The activator of the bundle "feature-deployment" is called. It can access the FeaturesService because of step 2. # It then register a deployment listener : this listener is called back with the status DEPLOYMENT_FINISHED. Because step 3 is not finished, the root region doesn't exist and the listener fails with a NPE I can provide you other details/artefacts, but I don't have access for now to a running instance. > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16808435#comment-16808435 ] Grzegorz Grzybek commented on KARAF-6074: - [~j3rem1e] I tried to reproduce with clean 4.2.4 and I wasn't able to do so... Normally, when clean Karaf starts, {{deployer}} feature is installed by feature service (from {{etc/org.apache.karaf.features.cfg}}, so the bundle activator of feature deployer is started *after* feature service sets lastDeploymentEvent to {{DeploymentEvent.DEPLOYMENT_STARTED}}. But when Karaf already starts another time, when boot was already done, region definition is read from bundle data storage / {{state.json}} file. Can you please share: * etc/org.apache.karaf.features.cfg * full log * content of {{deploy/}} directory (just {{ls -la}}) * content of {{$KARAF_HOME/data/cache/bundle11/data/state.json}} and {{digraph.json}} (bundle11 is in my case for {{mvn:org.apache.karaf.features/org.apache.karaf.features.core/4.2.4}} bundle) * output of {{bundle:list -l -t 0}} > 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 > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807671#comment-16807671 ] Grzegorz Grzybek commented on KARAF-6074: - [~j3rem1e] you're right... I wonder how it worked for me. I also wonder why: {code:java} private DeploymentEvent lastDeploymentEvent = DeploymentEvent.DEPLOYMENT_FINISHED; {code} is set to DEPLOYMENT_FINISHED, before it's really finished... I'll check the problem soon. > 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: Major > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807669#comment-16807669 ] J. Brébec commented on KARAF-6074: -- After upgrading to Karaf 4.2.4, this issue is always present : when the listener is registered, the FeaturesService emit the last deployment status, which is by default "DEPLOYMENT_FINISHED" (see [FeaturesServiceImpl#L128|https://github.com/apache/karaf/blob/cbf9755285b7de1a799449c765f3d339c1d8d25d/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java#L128]) I can see this in the logs : {code} 13:22:50.355 ERROR [vator-1-thread-2]|FeatureDeploymentListener | Unable to update deployed features for bundle: org.jline.terminal-jansi - 3.10.0 java.lang.NullPointerException at org.apache.karaf.deployer.features.FeatureDeploymentListener.bundleChanged(FeatureDeploymentListener.java:247) at org.apache.karaf.deployer.features.FeatureDeploymentListener.init(FeatureDeploymentListener.java:95) at org.apache.karaf.deployer.features.osgi.Activator$DeploymentFinishedListener.deploymentEvent(Activator.java:86) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.registerListener(FeaturesServiceImpl.java:295) at org.apache.karaf.deployer.features.osgi.Activator.doStart(Activator.java:53) at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:292) 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) at java.lang.Thread.run(Thread.java:748) 13:22:50.360 ERROR [vator-1-thread-2]|FeatureDeploymentListener | Unable to update deployed features for bundle: org.jline.terminal - 3.10.0 java.lang.NullPointerException at org.apache.karaf.deployer.features.FeatureDeploymentListener.bundleChanged(FeatureDeploymentListener.java:247) at org.apache.karaf.deployer.features.FeatureDeploymentListener.init(FeatureDeploymentListener.java:95) at org.apache.karaf.deployer.features.osgi.Activator$DeploymentFinishedListener.deploymentEvent(Activator.java:86) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.registerListener(FeaturesServiceImpl.java:295) at org.apache.karaf.deployer.features.osgi.Activator.doStart(Activator.java:53) at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:292) 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) at java.lang.Thread.run(Thread.java:748) {code} > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > Fix For: 4.2.3 > > > 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 >
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16746596#comment-16746596 ] ASF subversion and git services commented on KARAF-6074: Commit 6746a273a55b9ae038ac345caf0d99c296a0b4f5 in karaf's branch refs/heads/master from Grzegorz Grzybek [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=6746a27 ] Merge pull request #731 from grgrzybek/KARAF-6074 [KARAF-6074] Register FeatureDeploymentListener only after Deployment… > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16746594#comment-16746594 ] ASF subversion and git services commented on KARAF-6074: Commit 00ec77048512cf5da8437ab202e9430eeb68ac30 in karaf's branch refs/heads/master from Grzegorz Grzybek [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=00ec770 ] [KARAF-6074] Register FeatureDeploymentListener only after DeploymentEvent.DEPLOYMENT_FINISHED > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16746595#comment-16746595 ] ASF subversion and git services commented on KARAF-6074: Commit 6746a273a55b9ae038ac345caf0d99c296a0b4f5 in karaf's branch refs/heads/master from Grzegorz Grzybek [ https://gitbox.apache.org/repos/asf?p=karaf.git;h=6746a27 ] Merge pull request #731 from grgrzybek/KARAF-6074 [KARAF-6074] Register FeatureDeploymentListener only after Deployment… > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16746593#comment-16746593 ] ASF GitHub Bot commented on KARAF-6074: --- grgrzybek commented on pull request #731: [KARAF-6074] Register FeatureDeploymentListener only after Deployment… URL: https://github.com/apache/karaf/pull/731 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > Fix For: 4.2.3 > > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16746352#comment-16746352 ] ASF GitHub Bot commented on KARAF-6074: --- grgrzybek commented on pull request #731: [KARAF-6074] Register FeatureDeploymentListener only after Deployment… URL: https://github.com/apache/karaf/pull/731 …Event.DEPLOYMENT_FINISHED This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Grzegorz Grzybek >Priority: Major > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16735974#comment-16735974 ] J. Brébec commented on KARAF-6074: -- Yes. It's easy to reproduce with the default distrib in a debugger, by simulating a delay with a break point in "org.apache.karaf.features.internal.service.Deployer.deploy()" line 917 (callback.saveState() is the call which initialises the root region in the requirements on the first cold start). > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Jean-Baptiste Onofré >Priority: Major > > 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 (v7.6.3#76005)
[jira] [Commented] (KARAF-6074) Race condition between the FeaturesService and FeatureDeploymentListener
[ https://issues.apache.org/jira/browse/KARAF-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16735832#comment-16735832 ] Jean-Baptiste Onofré commented on KARAF-6074: - You use the regular {{etc/org.apache.karaf.features.cfg}} right ? No sync for feature install, correct ? > 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 > Environment: Karaf 4.2.2 Windows 7 and Equinox >Reporter: J. Brébec >Assignee: Jean-Baptiste Onofré >Priority: Major > > 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 (v7.6.3#76005)