[ https://issues.apache.org/jira/browse/LOGCXX-457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951031#comment-14951031 ]
Thorsten Schöning commented on LOGCXX-457: ------------------------------------------ Another hint for the problem: With an empty directory, test6 succeeded executing it 5 times after another, but only if I always clear the output directory in between. If not, it fails always after the first successful execution with an empty directory. And it's always with the same problem I've reported before: Process Monitor is showing the first generated file name missing. And now lets look at TimeBasedRollingPolicy::initialize: {code} LogString buf; ObjectPtr obj(new Date(currentFile.exists(pool) ? currentFile.lastModified(pool) : n)); formatFileName(obj, buf, pool); lastFileName = buf; {code} With an empty directory the current date is used, but if the file is already present, its last modification timestamp is used and that can be arbitrary in the past, but the tests all assume that everything happens within some seconds around "now". So on the first log attempt, the already present file is renamed to a name corresponding to its last mod time, which was most likely the last execution of the corresponding test and is most likely not something around "now". So it looks like the file has been created during the last run of the test, but is the first renamed file for the current test run and that first file is then missing in the checks which all assume file names around "now" plus some seconds. And that happens with all tests with already present files and it depends as well on how fast one re-executes the tests, because if the already present files stay within the some seconds of "now" it looks like the tests work. And if by accident the output dir is empty it looks like they work as well. Does that make more sense? > timebasedrollingtest fails for seconds related filenames > -------------------------------------------------------- > > Key: LOGCXX-457 > URL: https://issues.apache.org/jira/browse/LOGCXX-457 > Project: Log4cxx > Issue Type: Bug > Components: Tests > Affects Versions: 0.11.0 > Environment: Windows 8.1 x64, C++-Builder 10 Seattle > Reporter: Thorsten Schöning > Assignee: Thorsten Schöning > > I'm building 0.11.0 and except timebasedrollingtest all tests pass. Using > process monitor I can see that in that test some files with timestamps in > their name with seconds resolution are not available as expected and form > looking at the code in my opinion this is a bug in the test and can't work at > all. > Looking at the history, problems with this test have been reported before in > LOGCXX-206, where it first was simply disabled and enabled afterwards, but > without any noticable changes or documentation to the problem. It just seemed > to work now. > But lets look at test 6: First, some filenames are build containing a > timestamp starting with "now" and each new filename is expected to be one > second in the future. But the important thing is that the names start with > "now"! > Afterwards the tests waits always(!) for at least the next second, is than > writing to some files and checking the existence of the file names created > before with the expected timestamp names. Process Monitor reveals that the > first checked filename is always missing. > But isn't that expected behavior, because the first fielname is created with > "now" in mind, explicitly not in the future, and one second is waited > afterwards, so the writes are in the future now? This looks like it can't > ever work ever and it's always only the first file missing. > Besides that, there some code reduncany in that file, so I decided to create > this bug to document my findings, clean the code up a bit and deal with the > failing test afterwards. -- This message was sent by Atlassian JIRA (v6.3.4#6332)