[ZODB-Dev] Exception while closing ZODB
Ulla Theiss
u.theiss at eurodata.de
Mon Jul 5 06:00:55 EDT 2004
Hello list,
since Version Zope 2.7.0 we have a problem closing the ZODB under Windows.
Sometime the class LockFile (in the file .../ZODB/lock_file.py) throws
while unlinking the lockfile the Exception:
OSError: [Errno 13] Permission denied '....\\var\\...fs.lock'
We open and close ZODB-databases in different threads.
A look at the sourcecode in LockFile.close() shows, that
first
unlock_file(self._fp)
self._fp.close()
is called. Which means other threads and processes are able to use the
locked file again.
Afterwards the lock-file should be deleted:
os.unlink(self._path)
Therefore, if another thread already uses the lock-file, the first
thread is unable to delete it and the
'Permission denied' exception is thrown.
As a workaround we put the os.unlink - statement in a try-except-block.
def close(self):
if self._fp is not None:
unlock_file(self._fp)
self._fp.close()
try:
os.unlink(self._path)
self._fp = None
except:
pass
How to correct the error best?
Best wishes,
Ulla Theiss.
More information about the ZODB-Dev
mailing list