This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients Frans, lowell87, mramahi77, neyro, rcronk, vinay.sajip
Date 2009-06-09.23:35:21
SpamBayes Score 1.110223e-16
Marked as misclassified No
Message-id <1244590525.03.0.333730453822.issue4749@psf.upfronthosting.co.za>
In-reply-to
Content
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
output:

Exception in thread Thread-10:
Traceback (most recent call last):
  File "C:\Python\lib\threading.py", line 488, in __bootstrap_inner
    self.run()
  File "C:\temp\thredio.py", line 28, in run
    os.rename('logthred.log', dfn)
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.
History
Date User Action Args
2009-06-09 23:35:25vinay.sajipsetrecipients: + vinay.sajip, mramahi77, lowell87, neyro, rcronk, Frans
2009-06-09 23:35:25vinay.sajipsetmessageid: <1244590525.03.0.333730453822.issue4749@psf.upfronthosting.co.za>
2009-06-09 23:35:23vinay.sajiplinkissue4749 messages
2009-06-09 23:35:22vinay.sajipcreate