felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] Updated: (FELIX-335) Configuration Admin updates with empty properties and throws NullPointerExceptions due to race condition
Date Fri, 17 Aug 2007 13:12:30 GMT

     [ 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_2.patch

Thanks for the feedback.

I went over the code again and again found some issues:

(1) It seems that when a ManagedService is registered and a new configuration is found, the
configuration is immediately bound to the ManagedService. I assume, this is probably wrong.
So I added precaution to not bind brand new configuration to the ManagedService.

(2) The FilePersistenceManager does not seem to act very well in multithreaded situations:
A configuration file is directly written and thus may be read at the same time and hence returning
nothing at. I added synchronization to the load and store methods to prevent same-time access
to files as well as have the store method write to a temporary file which is renamed when
done.

Attached, find a new patch, which is complete in a sense, that it includes the changes of
yesterday.

Sorry to misuse you as the testbed for this... But I cannot currently come up with a good
muli-threaded test case.

> 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, ConfigAdmin.FELIX-335_2.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.


Mime
View raw message