You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "shriram (Jira)" <ji...@apache.org> on 2020/10/02 11:46:00 UTC

[jira] [Created] (KARAF-6865) Feature dependency is failing randomly in feature resolver

shriram created KARAF-6865:
------------------------------

             Summary: Feature dependency is failing randomly in feature resolver
                 Key: KARAF-6865
                 URL: https://issues.apache.org/jira/browse/KARAF-6865
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.1.4
            Reporter: shriram


I am writing an application which has a dependency with other feature.

- Feature A 
 - Feature B

Feature A has a dependency with Feature B so i declared it in

<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
 <repository>mvn:com.eclipsesource.jaxrs/features/4.3/xml/features</repository>
 <feature name="FeatureA" version="1.0.0" install="auto">
 <feature>FeatureB</feature>
 </feature>

Most of the times both the both the KAR's are properly deployed. Once in a while i am facing an issue that Feature B is only installed and listed in list command in KARAF console. But Feature A is there(there in deploy folder).

I have gone through the KARAF source code and found the logic that 
If feature A comes first it waits in **DelayedDeployerThread** with 2 milliseconds time. Once Feature B is installed it sets the variable cancel to true so comes out of the loop and FeatureA proceeds for installation.


 2020-09-29T11:46:36.122+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 48 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Installing KAR file /opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureA.kar
 2020-09-29T11:46:36.123+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 93 | 50 - org.apache.karaf.kar.core - 4.1.4 | Installing KAR test from file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureA.kar
 2020-09-29T11:46:36.124+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 96 | 50 - org.apache.karaf.kar.core - 4.1.4 | Uncompress the KAR file file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureA.kar into directory /opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/FeatureA
 2020-09-29T11:46:36.124+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory test
 2020-09-29T11:46:37.203+0200 | INFO | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 267 | 50 - org.apache.karaf.kar.core - 4.1.4 | Added feature repository 'file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/test/featureA/features_A.xml'
 2020-09-29T11:46:37.209+0200 | DEBUG | .4/instances/test/deploy | o.a.k.f.i.s.Blacklist | tures.internal.service.Blacklist 139 | 10 - org.apache.karaf.features.core - 4.1.4 | Unable to load blacklist bundles list
 2020-09-29T11:46:37.210+0200 | WARN | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 121 | 50 - org.apache.karaf.kar.core - 4.1.4 | Feature dependency FeatureB/0.0.0 is not available. Kar deployment postponed to see if it is about to be deployed
 2020-09-29T11:46:37.212+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 48 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Installing KAR file /opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureB.kar
 2020-09-29T11:46:37.213+0200 | DEBUG | Delayed kar deployment | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 287 | 50 - org.apache.karaf.kar.core - 4.1.4 | noAutoRefreshBundles is false
 2020-09-29T11:46:37.212+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 93 | 50 - org.apache.karaf.kar.core - 4.1.4 | Installing KAR FeatureB from file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureB.kar
 2020-09-29T11:46:37.213+0200 | DEBUG | Delayed kar deployment | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 291 | 50 - org.apache.karaf.kar.core - 4.1.4 | noAutoStartBundles is false (default false)
 2020-09-29T11:46:37.215+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 96 | 50 - org.apache.karaf.kar.core - 4.1.4 | Uncompress the KAR file file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureB.kar into directory /opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/FeatureB
 2020-09-29T11:46:37.216+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory FeatureB
 2020-09-29T11:46:37.216+0200 | INFO | Delayed kar deployment | o.a.k.f.i.s.FeaturesServiceImpl | rnal.service.FeaturesServiceImpl 1286 | 10 - org.apache.karaf.features.core - 4.1.4 | Adding features: FeatureA/[1.0.0,1.0.0]
 2020-09-29T11:46:37.217+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory FeatureB
 2020-09-29T11:46:37.217+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory bundles
 2020-09-29T11:46:37.219+0200 | DEBUG | features-1-thread-1 | o.a.k.f.i.s.Overrides | tures.internal.service.Overrides 130 | 10 - org.apache.karaf.features.core - 4.1.4 | Unable to load overrides bundles list

After this SimpleDownloadTask tries to install all the bundles from feature A.
and finally lands in the error

2020-09-29T11:46:37.901+0200 | WARN | Delayed kar deployment | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 297 | 50 - org.apache.karaf.kar.core - 4.1.4 | Unable to install Kar feature featureA/1.0.0

Expected behaviour is it should wait until the feature B completes and starts the installation. Same thing happens
in the success case

2020-09-28T19:18:07.846+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 75 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Found a .kar file to deploy.
 2020-09-28T19:18:07.846+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 75 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Found a .kar file to deploy.
 2020-09-28T19:18:07.846+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 48 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Installing KAR file /opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/featureA.kar
 2020-09-28T19:18:07.847+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 93 | 50 - org.apache.karaf.kar.core - 4.1.4 | Installing KAR test from file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureA.kar
 2020-09-28T19:18:07.848+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 96 | 50 - org.apache.karaf.kar.core - 4.1.4 | Uncompress the KAR file file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/FeatureA.kar into directory /opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/test
 2020-09-28T19:18:07.848+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory test
 2020-09-28T19:18:08.113+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory bundles
 2020-09-28T19:18:08.253+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory featureA
 2020-09-28T19:18:08.926+0200 | INFO | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 267 | 50 - org.apache.karaf.kar.core - 4.1.4 | Added feature repository 'file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/test/featureA/featuresA.xml'
 2020-09-28T19:18:08.934+0200 | WARN | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 121 | 50 - org.apache.karaf.kar.core - 4.1.4 | Feature dependency featureB/0.0.0 is not available. Kar deployment postponed to see if it is about to be deployed
 2020-09-28T19:18:08.936+0200 | INFO | .4/instances/test/deploy | o.a.k.d.k.KarArtifactInstaller | eployer.kar.KarArtifactInstaller 48 | 39 - org.apache.karaf.deployer.kar - 4.1.4 | Installing KAR file /opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/featureB.kar
 2020-09-28T19:18:08.936+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 93 | 50 - org.apache.karaf.kar.core - 4.1.4 | Installing KAR featureB from file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/featureB.kar
 2020-09-28T19:18:08.937+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 96 | 50 - org.apache.karaf.kar.core - 4.1.4 | Uncompress the KAR file file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/deploy/featureB.kar into directory /opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/featureB
 2020-09-28T19:18:08.937+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory featureB
 2020-09-28T19:18:08.938+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory featureB
 2020-09-28T19:18:08.938+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | rg.apache.karaf.kar.internal.Kar 157 | 50 - org.apache.karaf.kar.core - 4.1.4 | Creating directory bundles
 2020-09-28T19:18:10.866+0200 | DEBUG | .4/instances/test/deploy | o.a.k.f.i.s.Blacklist | tures.internal.service.Blacklist 139 | 10 - org.apache.karaf.features.core - 4.1.4 | Unable to load blacklist bundles list
 2020-09-28T19:18:10.869+0200 | INFO | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 267 | 50 - org.apache.karaf.kar.core - 4.1.4 | Added feature repository 'file:/opt/osgi/apache-custom-karaf-4.1.4/instances/test/data/kar/featureB/featureB/featuresB.xml'
 2020-09-28T19:18:10.871+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 287 | 50 - org.apache.karaf.kar.core - 4.1.4 | noAutoRefreshBundles is false
 2020-09-28T19:18:10.871+0200 | DEBUG | .4/instances/test/deploy | o.a.k.k.i.KarServiceImpl | araf.kar.internal.KarServiceImpl 291 | 50 - org.apache.karaf.kar.core - 4.1.4 | noAutoStartBundles is false (default false)


Not sure why the failures doesn't waits in the loop and continues for feature A installation also the time difference is 1 millisecond.
We are using maven plugin to generate the feature file and there is an documentation for an attribute "**prerequisite**" which mandates the feature B to complete(started/activated) before feature A 
Any help would be appreciated.

I tried it with prerequisites attribute in the feature  xml still issue persists.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)