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

Guillaume Nodet edited comment on ARIES-1732 at 8/3/17 12:23 PM:
-----------------------------------------------------------------

The problem is not located in the {{CmPropertyPlaceholder}} but rather in the 
{{ManagedObjectManager}} which is changed from:
{code}
            Dictionary<String, Object> config = 
CmUtils.getProperties(reg.getRegistration().getReference(), key);
            cm.updated(config);
{code}
to:
{code}
            Dictionary<String, Object> config = 
CmUtils.getProperties(reg.getRegistration().getReference(), key);
            if(config != null){
                LOGGER.debug("Invoking updated() just after ManagedObject 
registration");
                cm.updated(config);
            }
{code}
If the {{ConfigAdmin}} service is not available, {{CmUtils.getProperties}} 
returns {{null}}, so I think it will change the behavior.



was (Author: gnt):
The problem is not located in the {{CmPropertyPlaceholder}} but rather in the 
{{ManagedObjectManager}} which is changed from:
{code}
            Dictionary<String, Object> config = 
CmUtils.getProperties(reg.getRegistration().getReference(), key);
            cm.updated(config);
{code}
to:
{code}
            Dictionary<String, Object> config = 
CmUtils.getProperties(reg.getRegistration().getReference(), key);
            if(config != null){
                LOGGER.debug("Invoking updated() just after ManagedObject 
registration");
                cm.updated(config);
            }
{code}
If the {{ConfigAdmin}} service is not available, {{CmUtils.getProperties}} 
returns null, so I think it will change the behavior.


> blueprint-cm - race condition
> -----------------------------
>
>                 Key: ARIES-1732
>                 URL: https://issues.apache.org/jira/browse/ARIES-1732
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>            Reporter: Paolo Antinori
>
> There is a possible race condition in 
> `org.apache.aries.blueprint.compendium.cm.CmPropertyPlaceholder` and 
> `org.apache.aries.blueprint.compendium.cm.ManagedObjectManager`
> There are situations where `ConfigAdmin` service might not be available and 
> returns `null` when queried for the initial `config`.
> In other cases instead, `CmPropertyPlaceholder` receives updates from 
> `ConfigAdmin` thread even before it has completed it's initialization.
> The code doesn't discriminate if `config` is `null` or not, and treats any 
> value as valid, marking `CmPropertyPlaceholder` instance as initialized.
> This leads to spotty errors.
> The suggested fix, that simply prevents that `update(null)` invocation mark 
> the `CmPropertyPlaceholder` instance as initialized, addresses the issue.
> Code here:
> https://github.com/apache/aries/compare/trunk...paoloantinori:ENTESB-7141?expand=1



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

Reply via email to