aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Grzybek (JIRA)" <>
Subject [jira] [Commented] (ARIES-1732) blueprint-cm - race condition
Date Mon, 21 Aug 2017 11:07:03 GMT


Grzegorz Grzybek commented on ARIES-1732:

After several tests (I'll commit new blueprint-itests related to anyway), I think
we just can't add "do not accept null properties" to {{CmPropertyPlaceholder}}...

First - when configadmin is not available, we won't get the properties anyway (at least not
without using {{<cm:default-properties>}}). We won't get them when the PID is not available
as well.

Blueprint container is designed to wait for namespace handlers and services, but not for PID

When BP container is started and PID is not available and then later becomes available, using
{{<cm:property-placeholder update-strategy="reload">}} solves the problem.

When BP container is started and PID configuration *is* available, but bound to different
location, we *have* race condition, where:
CmUtils.getProperties(reg.getRegistration().getReference(), key)
returns valid properties, but:
private static class ConfigurationWatcher implements ManagedService {
    private ServiceRegistration registration;
    private List<ManagedObject> list = new CopyOnWriteArrayList<ManagedObject>();
    public ConfigurationWatcher() {
    public void updated(final Dictionary props) throws ConfigurationException {
        // Run in a separate thread to avoid re-entrance
        new Thread() {
            public void run() {
                for (ManagedObject cm : list) {
is getting {{null}} because {{}}
returns {{false}} - but this is the problem of e.g., fileinstall not allowing to set location
for CM configuration.

I believe that a solution to problem where {{ManagedService.updated()}} is getting null due
to wrong location is not changing CmPropertyPlaceholder, but rather ensuring that given PID
has _multiple location_ set (OSGi R5 CMPN, 104.4.1 Location Binding).

> blueprint-cm - race condition
> -----------------------------
>                 Key: ARIES-1732
>                 URL:
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>            Reporter: Paolo Antinori
>            Assignee: Grzegorz Grzybek
> There is a possible race condition in ``
and ``
> 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:

This message was sent by Atlassian JIRA

View raw message