[jira] [Commented] (CONFIGURATION-136) Reloading may corrupt the configuration

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CONFIGURATION-136) Reloading may corrupt the configuration

Gary D. Gregory (Jira)

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

Oliver Heger commented on CONFIGURATION-136:
--------------------------------------------

I had a look at the patch, but I am not sure whether I fully understand what you intend. I expected something similar to what Emmanuel had suggested in his comments, i.e. a modification of the {{reload()}} method to temporarily store the configuration's content before it is loaded again from disk.

But you modified the {{save()}} method. It looks like that you try to restore the original content of the configuration if an error occurs during saving. This does not solve the problem this ticket is about.

Also, are you sure that your solution is robust? I mean, if you get an error on saving (maybe because the disk is full or not readable), how likely is it that the rollback operation succeeds?
               

> Reloading may corrupt the configuration
> ---------------------------------------
>
>                 Key: CONFIGURATION-136
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-136
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 1.1
>            Reporter: nicolas de loof
>             Fix For: 1.9
>
>         Attachments: commons-configuration-1.5_patch_CONFIGURATION-136.jar, commons-configuration-1.8_patch_CONFIGURATION-136.jar, patch.txt
>
>
> Current reloading process clears current properties and load updated values from
> resource reader. If an IO error occurs (or invalid format), the configuration
> gets corrupted and the application becomes unstable.
> It may be better for hot-reload to put loaded values into a temporary Properties
> and replace previous values only when reloading is successful.
> It may also allow to use a 'currentlty-reloading' flag in the synchronized
> 'reload' block to avoid blocking threads during a reload (they could access
> safelly the 'old' properties until reload is finished)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira