[ 
https://issues.apache.org/jira/browse/CONFIGURATION-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831635#action_12831635
 ] 

Oliver Heger commented on CONFIGURATION-407:
--------------------------------------------

With regard to concurrent access most Configuration implementations behave 
similar to Java collections: it is intended that they can be read concurrently 
by multiple threads; however, if one thread updates the configuration, the 
developer has to ensure proper synchronization. This is documented in the 
user's guide 
(http://commons.apache.org/configuration/userguide/overview.html#Threading_issues)
 and should also be stated in the Javadocs of at least the configuration base 
classes.

The issue this ticket is about is somewhat special because here the 
implementation of a logic read method did temporarily change the status of the 
configuration object. So synchronization was needed to make sure that this 
method can be called concurrently. But updates by another thread are still not 
supported. Therefore the tests do not update the data in the configuration.

> HierarchicalINIConfiguration can throw an exception if the global section is 
> accessed concurrently
> --------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-407
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-407
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Oliver Heger
>            Assignee: Oliver Heger
>             Fix For: 1.7
>
>
> If the global section of a hierarchical INI configuration is requested, a new 
> ViewNode is created which becomes the root node of a new configuration for 
> the global section. Nodes representing properties of the global section are 
> added to this ViewNode. This operation temporarily changes the parent node of 
> these nodes which may cause problems if the method is called by multiple 
> threads concurrently. Because access to a section is a read-only operation, 
> this should be thread-safe.
> The probability that this error happens is pretty low IMO. Therefore it 
> should be hard to create a unit test.
> The issue can be fixed by synchronizing the add operation to the ViewNode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to