I'm seeing some surprising behavior regarding file handles in Windows.
I have two processes both trying to acquire read-only file handles to the same underlying file.
Process A (a Go binary) opens up a read-only file handle to that file and then uses it to acquire an exclusive lock on the file.
Process B (a Python binary) then tries to open up a read-only file handle on the same file, which results in the following IOError
:
IOError: [Errno 13] Permission denied: 'C:\\path\\to\\file.txt'
When Process A isn't around, Process B has no problem opening up the file.
As far as I know, there's no problem with two processes on Windows both holding read-only file descriptors to the same file, and I haven't found any documentation to suggest that one of those processes holding an exclusive lock changes that.
Does anyone know what might be causing the Python open()
call to fail?
(If it's helpful, the Go file locking implementation that I'm using is this one.)