You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "David Jencks (JIRA)" <ji...@apache.org> on 2013/02/10 09:27:12 UTC

[jira] [Updated] (FELIX-3838) [DS] Race condition in ImmediateComponentHolder

     [ https://issues.apache.org/jira/browse/FELIX-3838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Jencks updated FELIX-3838:
--------------------------------

    Fix Version/s: scr-1.8.0
    
> [DS] Race condition in ImmediateComponentHolder
> -----------------------------------------------
>
>                 Key: FELIX-3838
>                 URL: https://issues.apache.org/jira/browse/FELIX-3838
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Glenn Marcy
>            Assignee: David Jencks
>             Fix For: scr-1.8.0
>
>         Attachments: felix-scr.89998-patch.txt
>
>
> There is a race condition where one thread is running the BundleComponentActivator
> and calling enableComponents on the ImmediateComponentHolder when another thread
> is running that has called configurationUpdated.  The first thread is executing
> this:
>         m_enabled = true;
>         final ImmediateComponentManager[] cms = getComponentManagers( false );
>         ...
>             for ( ImmediateComponentManager cm : cms )
>             {
>                 cm.enable( async );
>             }
> The second thread is executing this:
>                 // enable the component if it is initially enabled
>                 if ( m_enabled && getComponentMetadata().isEnabled() )
>                 {
>                     newIcm.enable( false );
>                     ...
>                 }
>                 // store the component in the map
>                 putComponentManager( pid, newIcm );
> The failing sequence is this:
> The second thread executes the test of m_enabled and it is false, so it will not
> enable the component manager expecting that it will be enabled by enableComponents
> later when it is called.  The first thread then sets m_enabled to true and gets a
> copy of the entries in the map of component managers in order to enable them.  The
> second thread puts the component manager into that map, but after the first thread
> has already made a copy of the managers in that map, so the component manager the
> second thread created will not be enabled at all.

--
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