[Python-Dev] windows file closing race condition? (original) (raw)
Richard Oudkerk shibturn at gmail.com
Fri Sep 6 13:50:34 CEST 2013
- Previous message: [Python-Dev] windows file closing race condition?
- Next message: [Python-Dev] windows file closing race condition?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 06/09/2013 11:23am, Tim Golden wrote:
On 06/09/2013 11:14, Antoine Pitrou wrote:
Le Fri, 06 Sep 2013 08:58:06 +0100, Tim Golden <mail at timgolden.me.uk> a écrit :
What should Python do? Maybe using FILESHAREDELETE could help? http://bugs.python.org/issue15244 I don't think so. It's the use of FILESHAREDELETE (by other programs, eg Virus Checkers) that typically causes the problem. IOW, the sequence is: * [Some Other Prog] takes FILESHAREDELETE handle, allowing other programs to delete the file even while this handle is still open * Python calls DeleteFile -- succeeds if the only open handles are FILESHAREDELETE; carries on * File has apparently disappeared but still has open handles * Any attempt to create a file of the same name or to delete a containing directory fail because the file is still open, even though it's successfully been deleted. * (Some time later) [Some Other Prog] closes its handle and the file is now completely gone Unless I'm missing something, there's nothing Python can do to help here apart from the sort of delay-retry dance which test.support uses and which I'm advocating against as a core feature.
Instead of deleting, the file could be moved to a temporary name in the root directory (or some other permanent directory on the same drive) and then deleted. That would allow the directory to be closed even if a FILE_SHARE_DELETE handle is still open for the file.
-- Richard
- Previous message: [Python-Dev] windows file closing race condition?
- Next message: [Python-Dev] windows file closing race condition?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]