karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Konstantinov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-2275) ConcurrentModificationException from FeaturesService#listFeatures()
Date Fri, 19 Apr 2013 07:15:16 GMT

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

Dmitry Konstantinov commented on KARAF-2275:
--------------------------------------------

Yes, the problem was reproduced only once. Karaf is starting, we have a separate monitoring
thread is run during a blueprint bean activation. This thread try to find bundles for installed
features using FeaturesService:
{code}
private Feature findFeatureByBundle(Bundle bundle) throws Exception {
    for (Feature feature : featuresService.listFeatures()) {
        for (BundleInfo  bundleInfo : feature.getBundles()) {
            if (bundleInfo.getLocation().equals(bundle.getLocation())) {
                return feature;
            }
        }
    }
    return null;
} 
{code}

This code is invoked by the following code: 
{code}
public void addModuleActivator(ServiceReference moduleActivatorReference) {
        try {
            Bundle moduleBundle = moduleActivatorReference.getBundle();
            Feature feature = findFeatureByBundle(moduleBundle);
{code}

where addModuleActivator is a service tracking method configured via blueprint:
{code}
<reference-list id="moduleActivators" interface="com.my.applied.code.api.ModuleActivator"
                    availability="optional">
        <reference-listener ref="moduleActivatorTracker"
                            bind-method="addModuleActivator"
                            unbind-method="removeModuleActivator" />
</reference-list>
{code}
It's looks like FeaturesService is not thread-safe, the internal state is not guarded by any
locks and thread-safe collections are not used to hold it
                
> ConcurrentModificationException from FeaturesService#listFeatures()
> -------------------------------------------------------------------
>
>                 Key: KARAF-2275
>                 URL: https://issues.apache.org/jira/browse/KARAF-2275
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-feature
>    Affects Versions: 2.3.1
>         Environment: Windows 7, x64
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
> Karaf 2.3.1
>            Reporter: Dmitry Konstantinov
>
> {noformat}
> java.util.ConcurrentModificationException
>         at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)[:1.6.0_30]
>         at java.util.HashMap$ValueIterator.next(HashMap.java:822)[:1.6.0_30]
>         at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:1066)
>         at org.apache.karaf.features.internal.FeaturesServiceImpl.listFeatures(FeaturesServiceImpl.java:989)
>         at Proxyd0eb59e8_9c93_47ae_ac94_2f2421663dc8.listFeatures(Unknown Source)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message