Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When you:
1) register as a configuration listener
2) wait for the ConfigurationAdmin service to start
3) upon start, immediately create a new configuration and update its properties
You (sometimes) get a NPE in the UpdateThread because there is a race condition in the codebase:
a) ConfigurationManager.java:1818 will invoke getServiceReference() which uses the service registration to get to the reference
b) ConfigurationManager.java:242 registers the service and assigns the registration to 'configurationAdminRegistration'
First of all, the call to registerService in line 242 will already trigger service listeners and trackers to invoke callbacks before this call returns, so 'configurationAdminRegistration' will still be null. Furthermore, there is no synchronization, the member is not volatile, so we need to make sure this value is really written before any configuration events are created under a) (now the thread doing that is started way before the service is registered).
I will commit a test that shows the exception, but since it happens in a thread I cannot "catch" it won't show up as a failed test.
Attachments
Issue Links
- is duplicated by
-
FELIX-3390 Intermittent NPE in ConfigurationManager
- Closed