karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J. Brébec (JIRA) <j...@apache.org>
Subject [jira] [Commented] (KARAF-5371) Race condition between FeatureService and Fileinstall
Date Tue, 10 Oct 2017 12:31:01 GMT

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

J. Brébec commented on KARAF-5371:
----------------------------------

In fact, I can reproduce this issue in my i-test, with pax-exam. Sometime, the call {code}bundleContext.getBundle(0){code}
return a null pointer because the calling bundle is not referenced in a region when it calls
getBundle(). 

~ 8% of my itest fails because of this issue (for example, Arie Blueprint Extender call getBundle(0)
on every bundle registration to check if this bundle is the system bundle)

I have fixed it locally with a (really ugly..) patch in the Activator :

{code}
final FindHook regionBundleFindHook = dg.getBundleFindHook();
register(org.osgi.framework.hooks.bundle.FindHook.class, new FindHook() {

	@Override
	public void find(BundleContext context, Collection<Bundle> bundles) {
		if (bundles.size() == 1 && bundles.iterator().next().getBundleId() == 0) {
			return;
		}
		regionBundleFindHook.find(context, bundles);
	}
});
{code}

maybe allowing a bundle which is not in a region to see every events/bundles is more correct,
but I didn't investigate more...

> Race condition between FeatureService and Fileinstall
> -----------------------------------------------------
>
>                 Key: KARAF-5371
>                 URL: https://issues.apache.org/jira/browse/KARAF-5371
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-feature
>    Affects Versions: 4.1.2
>            Reporter: J. Brébec
>            Assignee: Guillaume Nodet
>            Priority: Critical
>             Fix For: 4.2.0, 4.1.3
>
>
> If a bundle is installed when the FeatureService is started, then it is possible that
this bundle is not associated to the default region. as a consequence, every services exported
by this bundle are not visible from the osgi container, until karaf is restarted.
> A real usecase :
> - A new karaf distribution, with a blueprint file in a folder managed by fileinstall
;
> - When the distribution is started, as fileinstall is started before the feature bundle,
and the folder are watched asynchronously, the blueprint file is installed before or in the
same time the featureservice is started
> => the services exported by the blueprint file are not visible
> This race condition is located in the FeatureService activator : the digraph is loaded,
and every bundle not known are added to the default region. then, it subscribes a bundle-listener
: If a bundle X is installed between the digraph loading and the subscription of the bundle
listener, then this bundle X is not attached to the default region.
> On my machine, this issue happens 70% of the time on a cold start.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message