[logback-dev] [JIRA] Updated: (LBCORE-183) race condition when creating log directory in multithreaded environment
Mats Henrikson (JIRA)
noreply-jira at qos.ch
Wed Dec 8 01:43:51 CET 2010
[ http://jira.qos.ch/browse/LBCORE-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mats Henrikson updated LBCORE-183:
----------------------------------
Attachment: parent_dirs.patch
> race condition when creating log directory in multithreaded environment
> -----------------------------------------------------------------------
>
> Key: LBCORE-183
> URL: http://jira.qos.ch/browse/LBCORE-183
> Project: logback-core
> Issue Type: Bug
> Components: Other
> Affects Versions: 0.9.26
> Reporter: Mats Henrikson
> Assignee: Logback dev list
> Attachments: parent_dirs.patch
>
>
> There is a race condition when multiple threads are trying to create the same parent log directory in logback:
> {noformat}
> java.lang.IllegalStateException: /path/to/log/dir/2010/2010_12/2010_12_08/file.log should not have existing parent directory
> at ch.qos.logback.core.util.FileUtil.createMissingParentDirectories(FileUtil.java:43) ~[logback-core-0.9.26.jar:na]
> at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:156) ~[logback-core-0.9.26.jar:na]
> at ch.qos.logback.core.FileAppender.start(FileAppender.java:115) ~[logback-core-0.9.26.jar:na]
> [...]
> {noformat}
> It is completely ok for the check to start if the directory is there and then have the directory appear when we actually come around to creating it. This is because you may have multiple threads wanting to log to the same directory, and if they try to create the dir at the same time one will succeed and one will have it already created. This happens for instance in the case above where a new dir is created at midnight every day, and two threads log at the same time.
> Will attach a patch that fixes the problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list