You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2009/05/25 16:11:45 UTC

[jira] Reopened: (FELIX-1162) Component.getReferences returns null if a component that has references is not enabled.

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

Felix Meschberger reopened FELIX-1162:
--------------------------------------


This patch is not correct, since it does not correctly handle reference counting.

When a bundle is activated all its component are created (along with the DependencyManagers). This sets all reference counters of the DependencyManagers (the m_size field) to the number of already registered services matching the reference. For references to services in the same bundle, this number is always zero.

After setting up the component they are scheduled for enablement. Thus all components are asynchronously enabled.

Now it may (and will) happen that services may be registered matching references of DependencyManagers without the respective reference counter being incremented because the DependencyManager is not yet enabled and thus not listening for service events.

When the component in question is then enabled, the DependencyManager still has the m_size field set to zero, where actually it should be 1 (or more). Consequently the reference may not be assumed satisified and hence the component may fail to activate.

The probable fix is to setup the initial value of the m_size not in the DependencyManager constructor but in the enable() method along with the service listener registration.

> Component.getReferences returns null if a component that has references is not enabled.
> ---------------------------------------------------------------------------------------
>
>                 Key: FELIX-1162
>                 URL: https://issues.apache.org/jira/browse/FELIX-1162
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.0.8
>            Reporter: Agemo Cui
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: scr-1.0.10
>
>         Attachments: FELIX-1162.patch
>
>
> The implementation of method {color:blue}org.apache.felix.scr.Component.getReferences{color} in class {color:blue}org.apache.felix.scr.impl.AbstractComponentManager{color} doesn't use {color:red}m_componentMetadata{color} but {color:red}m_dependencyManagers{color} to return the service references of a component, which causes a calling of {color:blue}getReferences{color} to return null before "enable component" is scheduled.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.