提交 45881a7d authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed problem with compile lock where a lock might persist indefinitely

上级 662e832b
...@@ -219,10 +219,18 @@ class Unlocker(): ...@@ -219,10 +219,18 @@ class Unlocker():
jobs running in parallel to unlock the same directory at the same time jobs running in parallel to unlock the same directory at the same time
(e.g. when reaching their timeout limit). (e.g. when reaching their timeout limit).
""" """
# If any error occurs, we assume this is because someone else tried to
# unlock this directory at the same time.
# Note that it is important not to have both remove statements within
# the same try/except block. The reason is that while the attempt to
# remove the file may fail (e.g. because for some reason this file does
# not exist), we still want to try and remove the directory.
try: try:
self.os.remove(self.os.path.join(self.tmp_dir, 'lock')) self.os.remove(self.os.path.join(self.tmp_dir, 'lock'))
except:
pass
try:
self.os.rmdir(self.tmp_dir) self.os.rmdir(self.tmp_dir)
except: except:
# Assume someone else tried to unlock this directory at the same time.
pass pass
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论