remove log handlers that were added during tests, to ensure effective cleanup of log files#1282
Conversation
|
Refer to this link for build results (access rights to CI server needed): |
|
Not out of the woods yet: |
|
Hmm, problems mentioned above seemed to be caused by a known bug, see http://bugs.python.org/issue10949 (Jenkins is running Python 2.6). |
|
Refer to this link for build results (access rights to CI server needed): |
|
OK, found the actual culprit of the log files not being removed: the log handlers were not being cleaned up... Simple fix, huge impact. |
|
with this patch: Ran 284 tests in 313.337s without this patch: Ran 284 tests in 907.145s |
|
looks fine |
There was a problem hiding this comment.
this can go because we restore the original env anyway, right?
There was a problem hiding this comment.
yep, no need to treat this separately
|
Refer to this link for build results (access rights to CI server needed): |
|
@boegel can you explain why this makes such a huge difference in performance?! |
|
@pforai: Not removing the log handlers means that they stay in place, and also keep getting used. Every time Near the end of the test suite, over 100 handlers were still active, all of which were still writing to disk (even though the inode of the log file was already removed via Before this patch, about 3GB of disk space was required in That's actually was caused us diving into this: Some other changes were also done in this PR, i.e. not reconfiguring in |
remove log handlers that were added during tests, to ensure effective cleanup of log files
|
@boegel nice! |
…space remove log handlers that were added during tests, to ensure effective cleanup of log files
Although each test is properly cleaning up the tmp dir that was assigned to it in
tearDown, the disk space used by the log files was not being freed because of open file handles on the log files.I looked into properly cleaning up those file handles to trigger the disk space being freed, but this proved to be far from trivial (I concluded this after quite a couple of hours of digging around, accompanied with lots of swearing).
Alternative solution (thanks to @stdweird for the tip): quickly rotate the log files, so that only small bits (max 1MB per log) are left behind in the overall tmp directory used by the running test suite.
This effectively trims the required disk space in /tmp (or equivalent) down from ~3GB to less than 100MB.