You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Emmanuel Bourg (JIRA)" <ji...@apache.org> on 2007/05/30 17:52:15 UTC

[jira] Created: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

ConcurrentModificationException in PropertiesConfigurationLayout
----------------------------------------------------------------

                 Key: CONFIGURATION-278
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: Emmanuel Bourg
             Fix For: 1.5


PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :

java.util.ConcurrentModificationException
    at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
    at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
    at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
    at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
    at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
    at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
    at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
    at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
    at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
    at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
    at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
    at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
    at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)

This happens easily in a multi threaded application using a central configuration with auto saved enabled.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-278.
----------------------------------------

    Resolution: Won't Fix

The Javadocs of the most popular configuration classes were updated with notes about threading issues. A similar note was also added to the user guide.

PropertiesConfiguration is not thread-safe per se, so closing this issue as won't fix.

If desired, a new ticket can be created for requesting means of supporting synchronized configurations.

> ConcurrentModificationException in PropertiesConfigurationLayout
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-278
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Emmanuel Bourg
>             Fix For: 1.5
>
>
> PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :
> java.util.ConcurrentModificationException
>     at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
>     at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
>     at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
>     at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
>     at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
>     at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
>     at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
>     at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)
> This happens easily in a multi threaded application using a central configuration with auto saved enabled.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500685 ] 

Oliver Heger commented on CONFIGURATION-278:
--------------------------------------------

Most of our configuration classes are not thread-safe when they are updated (concurrent read-only access should be unproblematic though). For instance BaseConfiguration uses a plain Map for storing its data.

I disagree that unpredictable results in case of concurrent modifications are better than an exception. This would make bugs of this kind nearly undetectable. The tread-safety (or unsafety) of the configuration classes should be clearly documented (I am not sure whether there is already some information about this on our site), then it is up to the user to handle this properly.

A decorator for synchronizing configurations is something I also had in mind. This is analogous to the way the Java collections framework handles this topic: plain collections are unsynchronized, but if needed, synchronization can easily be added. I am not sure how such a decorator could be implemented in an elegant way; maybe AOP or dynamic proxies could be a good choice.

So I would suggest closing this ticket as WON'T FIX and opening a new one for the decorator.

> ConcurrentModificationException in PropertiesConfigurationLayout
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-278
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Emmanuel Bourg
>             Fix For: 1.5
>
>
> PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :
> java.util.ConcurrentModificationException
>     at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
>     at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
>     at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
>     at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
>     at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
>     at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
>     at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
>     at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)
> This happens easily in a multi threaded application using a central configuration with auto saved enabled.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500225 ] 

Oliver Heger commented on CONFIGURATION-278:
--------------------------------------------

The internally used layoutData map should probably be better synchronized.

Just wondering: How can an event be received while the save() method is executed? Is the PropertiesConfiguration object that is accessed by multiple threads properly synchronized? We state that configurations need to be manually synchronized if they are modified concurrently.

> ConcurrentModificationException in PropertiesConfigurationLayout
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-278
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Emmanuel Bourg
>             Fix For: 1.5
>
>
> PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :
> java.util.ConcurrentModificationException
>     at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
>     at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
>     at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
>     at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
>     at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
>     at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
>     at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
>     at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)
> This happens easily in a multi threaded application using a central configuration with auto saved enabled.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500622 ] 

Emmanuel Bourg commented on CONFIGURATION-278:
----------------------------------------------

The configuration is not manually synchronized. Even if Commons Configuration is not fully thread safe I think we can at least the most frequent failure points in a multi threaded environment. The result could be unpredictable, but the code shouldn't crash with an exception.

That makes me think that we could provide a SynchronizedConfiguration decorator that may help people synchronizing their configurations.


> ConcurrentModificationException in PropertiesConfigurationLayout
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-278
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Emmanuel Bourg
>             Fix For: 1.5
>
>
> PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :
> java.util.ConcurrentModificationException
>     at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
>     at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
>     at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
>     at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
>     at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
>     at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
>     at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
>     at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)
> This happens easily in a multi threaded application using a central configuration with auto saved enabled.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Issue Comment Edited: (CONFIGURATION-278) ConcurrentModificationException in PropertiesConfigurationLayout

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500622 ] 

Emmanuel Bourg edited comment on CONFIGURATION-278 at 6/1/07 1:45 AM:
----------------------------------------------------------------------

The configuration is not manually synchronized. Even if Commons Configuration is not fully thread safe I think we can at least fix the most frequent failure points in a multi threaded environment. The result could be unpredictable, but the code shouldn't crash with an exception.

That makes me think that we could provide a SynchronizedConfiguration decorator that may help people synchronizing their configurations.



 was:
The configuration is not manually synchronized. Even if Commons Configuration is not fully thread safe I think we can at least the most frequent failure points in a multi threaded environment. The result could be unpredictable, but the code shouldn't crash with an exception.

That makes me think that we could provide a SynchronizedConfiguration decorator that may help people synchronizing their configurations.


> ConcurrentModificationException in PropertiesConfigurationLayout
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-278
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-278
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Emmanuel Bourg
>             Fix For: 1.5
>
>
> PropertiesConfigurationLayout is not thread safe, if a configuration event is received when the configuration is being saved, a ConcurrentModificationException is thrown :
> java.util.ConcurrentModificationException
>     at org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
>     at org.apache.commons.collections.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:455)
>     at org.apache.commons.configuration.PropertiesConfigurationLayout.save(PropertiesConfigurationLayout.java:455)
>     at org.apache.commons.configuration.PropertiesConfiguration.save(PropertiesConfiguration.java:410)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:517)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:484)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:451)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:425)
>     at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:373)
>     at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:725)
>     at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(AbstractFileConfiguration.java:764)
>     at org.apache.commons.configuration.DataConfiguration.clearProperty(DataConfiguration.java:109)
>     at org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:483)
> This happens easily in a multi threaded application using a central configuration with auto saved enabled.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org