Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4349

Synchronization issue in ComponentRegistry

    XMLWordPrintableJSON

Details

    Description

      Investigating an issue in some of our integration test, we found that the ComponentRegistry#m_missingDependencies field is wrongly synchronized.

      Two methods are accessing this Map, registerMissingDependency and missingServicePresent, but only the first one is synchronized.

      Patch proposed:

      diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
      index 9b307a9..c40ab5f 100644
      --- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
      +++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
      @@ -660,7 +660,7 @@ public class ComponentRegistry implements ScrService, ServiceListener
               }
           }
       
      -    public void missingServicePresent( final ServiceReference serviceReference, ComponentActorThread actor )
      +    public synchronized void missingServicePresent( final ServiceReference serviceReference, ComponentActorThread actor )
           {
               final List<Entry> dependencyManagers = m_missingDependencies.remove( serviceReference );
               if ( dependencyManagers != null )
      

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            gnodet Guillaume Nodet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: