[ 
https://issues.apache.org/jira/browse/KARAF-3798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15139344#comment-15139344
 ] 

Fabian Lange commented on KARAF-3798:
-------------------------------------

A new stack trace which seems common in 4.0.4 for the same issue:
{code}
java.lang.NullPointerException
        at java.io.FileOutputStream.<init>(FileOutputStream.java:203)[:1.8.0_72]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)[:1.8.0_72]
        at 
org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:197)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:297)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1154)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:764)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1089)[7:org.apache.karaf.features.core:4.0.4]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:985)[7:org.apache.karaf.features.core:4.0.4]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_72]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_72]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_72]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_72]
{code}
What I noticed is that also "BootFinished" is called prematurely.

>From 
>org.apache.karaf.features.internal.service.BootFeaturesInstaller.installBootFeatures():
{code}
            List<Set<String>> stagedFeatures = parseBootFeatures(features);
            for (Set<String> features : stagedFeatures) {
                featuresService.installFeatures(features, 
EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound));
            }
            featuresService.bootDone();
            publishBootFinished();
{code}
because installFeatures is async, bootFinished is invoked as soon as the task 
for the thread has been scheduled, but not when the boot is actually done (and 
all boot features are in state installed

> FeaturesServiceImpl not threadsafe
> ----------------------------------
>
>                 Key: KARAF-3798
>                 URL: https://issues.apache.org/jira/browse/KARAF-3798
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-feature
>    Affects Versions: 4.0.0.M3
>            Reporter: Fabian Lange
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.1.0, 4.0.5
>
>
> This error happens pretty frequently with M3, when there are multiple 
> features installed on startup and config files to activate them created.
> {code}
> 2015-06-19 15:55:12,249 | ERROR | 43-3aaf88a7bd8b) | configadmin              
>         | 3 - org.apache.felix.configadmin - 1.8.4 | Unexpected problem 
> delivering configuration event to [org.osgi.service.cm.ConfigurationListener, 
> id=30, bundle=9/mvn:org.apache.felix/org.apache.felix.scr/1.8.2]
> java.lang.NullPointerException
>       at 
> org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(ConfigurationSupport.java:283)[9:org.apache.felix.scr:1.8.2]
>       at 
> org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2036)[3:org.apache.felix.configadmin:1.8.4]
>       at 
> org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2005)[3:org.apache.felix.configadmin:1.8.4]
>       at 
> org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)[3:org.apache.felix.configadmin:1.8.4]
>       at java.lang.Thread.run(Thread.java:745)[:1.8.0_40]
> {code}
> As written in latest comment, the root cause seems to be that multiple 
> installFeature calls to FeatureService mess up the state of the bundles. In 
> my case it left a bundle in a corrupt state, which was noticed when the 
> configuration change did not really activate the service.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to