[
https://issues.apache.org/jira/browse/FELIX-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Meschberger updated FELIX-335:
------------------------------------
Attachment: ConfigAdmin.FELIX-335.patch
Thanks for reporting this issue.
After looking deeper into the problems, I realize there is more than just this:
(1) If a configuration object is created it has to be persisted (104.7.1) but
getProperties() must return null as long as the configuration object is not
updated with properties. If now, the framework (or actually the Configuration
Admin service) is restarted before such an update takes place, I assume,
getProperties() must still return null after the restart. Currently, empty
properties is returned in this case.
(2) As a configuration object has to be persisted upon creation, the save
operation is where I originally put it. But it is correct, that there is a race
condition, where multiple configuration objects might be created or the may be
incomplete.
(3) If a ManagedService is registered but no configuration is available
(assuming that newly created configuration prior to a first update is
equivalent to non-existing) the updated() method must be called with null.
Currently, either a NullPointerException may occurr or an empty directory may
wrongly be given to the updated() method.
(4) If a ManagedService is updated with configuration, the bundle location is
not always set on the configuration object.
(5) it may be, that the callPlugins method is called with a configuration
object, which is new and therefore getProperties() returns null and hence the
callPlugins might throw a NullPointerException.
Given all these issues, I restructured accessing configurations from the cache
and the persistent store as well as ensuring the "new" state survives a restart.
What do you think ?
> Configuration Admin updates with empty properties and throws
> NullPointerExceptions due to race condition
> --------------------------------------------------------------------------------------------------------
>
> Key: FELIX-335
> URL: https://issues.apache.org/jira/browse/FELIX-335
> Project: Felix
> Issue Type: Bug
> Components: Configuration Admin
> Reporter: Karl Pauls
> Assignee: Felix Meschberger
> Attachments: ConfigAdmin.FELIX-335.patch, empty-properties.patch
>
>
> There appears to be a race condition in the configuration admin that allows
> managed services to get updated with empty properties (but not null).
> Furthermore, due to the same bug NullPointerExceptions appear under heavy
> load.
> Fortunately, I think I was able to isolate the bug. The issue is that
> configurations are persisted when created but before they are initialized
> (i.e., given a configuration). If during this window a new ManagedService
> appears it gets updated with an empty Dictionary. Likewise, if the
> configuration is re-read after such an update attempt it does not have a pid
> which causes the null pointer exceptions.
> The fix seems to be rather simple (unless I'm missing something :-) but took
> me some time to figure out.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.