karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-4899) FeatureService dissociates concurrently installed bundles from their region
Date Mon, 19 Dec 2016 17:03:58 GMT
Benjamin Bentmann created KARAF-4899:

             Summary: FeatureService dissociates concurrently installed bundles from their
                 Key: KARAF-4899
                 URL: https://issues.apache.org/jira/browse/KARAF-4899
             Project: Karaf
          Issue Type: Bug
          Components: karaf-feature
    Affects Versions: 4.0.8, 4.0.5
            Reporter: Benjamin Bentmann

Take the following scenario:
# thread A executes {{FeatureServiceImpl.doProvision()}} and just completed the call to {{getDeploymentState()}}
# thread B calls {{BundleContext.installBundle()}}, as part of processing the resulting {{BundleEvent.INSTALLED}}
event the {{RegionBundleEventHook}} will associate the new bundle with a region
# thread A continues {{doProvision()}} and eventually calls {{FeatureServiceImpl.replaceDigraph()}},
due to having used the bundle sets recorded in the deployment state from step 1 (which is
outdated since thread B installed a new bundle) the new region digraph fails to mention the
newly installed bundle from step 2, effectively making it region-less.

In case that description is not clear enough, example call stacks of the racing threads, thread

Thread [pool-2-thread-1]	
line: 1103	
org.apache.karaf.features.internal.service.State, java.util.EnumSet<org.apache.karaf.features.FeaturesService.Option>,
java.lang.String) line: 1174	
	org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call() line: 1074	
	java.util.concurrent.FutureTask<V>.run() line: 266	
line: 1142	
	java.util.concurrent.ThreadPoolExecutor$Worker.run() line: 617	
	java.lang.Thread.run() line: 745	

thread B:
Daemon System Thread [RMI TCP Connection(1)-]	
	org.apache.felix.framework.Felix.installBundle(org.osgi.framework.Bundle, java.lang.String,
java.io.InputStream) line: 3004	
	org.apache.felix.framework.BundleContextImpl.installBundle(java.lang.String, java.io.InputStream)
line: 167	
	org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.installBundle(java.lang.String, byte[])
line: 107	

The sporadic failures resulting from this race condition likely vary, in our case of a pax-exam-based
test, the consequence is {{org.ops4j.pax.swissbox.tracker.ServiceLookupException: gave up
waiting for service org.ops4j.pax.exam.ProbeInvoker}} errors caused by the fact that the bundle
events (in particular {{STARTED}}) for the test probe bundle don't make it to the registered
listeners because the test probe bundle became region-less whereas the listener (like everything
else) belongs to the "root" region.

This message was sent by Atlassian JIRA

View raw message