[issue4749] Issue with RotatingFileHandler logging handler on Windows
report at bugs.python.org
Wed Jun 10 01:35:25 CEST 2009
Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:
I've just run a test several times - it's your original script with
joins added at the end. I kept the acquire_lock and release_lock calls
but made them only do anything if a constant USE_LOCK was True. I set
this to False, so that no locking is actually occurring.
My earlier tests had run with Windows indexing not turned off properly
(there's an option to turn off for all subfolders which I mistakenly
didn't select, so that I had only turned it off on the root folder).
Now, I've turned off search indexing for the entire volume, as well as
the anti-virus, and re-run the tests. I also found that the TortoiseSVN
Windows shell extension sometimes scans files if you are working inside
a directory which is part of an SVN checkout, so I was careful to work
outside any SVN tree.
I also ran SysInternals filemon. I attach the log: it appears to show
that a SHARING VIOLATION (the WindowsError 32) is occurring specifically
because of interaction with a spawned os.system child process. However,
this does not appear to be logging-specific: my conjecture is that when
the cmd.exe is spawned, it inherits file handles from the parent process
(the Python process which is doing the logging). When cmd.exe exits, it
closes all its open file handles, thereby pulling the rug out from under
the Python process.
To confirm this, I created another script, thredio.py, which does not
use logging but does the equivalent I/O operations (including using a
threading lock around them to serialise access from the threads - but
there is no locking around the os.system() calls).
Guess what - the same error occurs. Here's the extract from the console
Exception in thread Thread-10:
Traceback (most recent call last):
File "C:\Python\lib\threading.py", line 488, in __bootstrap_inner
File "C:\temp\thredio.py", line 28, in run
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process
So, I submit that this is not a logging issue, and am closing this issue.
Added file: http://bugs.python.org/file14247/python-logging-capture.log
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list