mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
hg: add even more debug messaging around locks
Summary: We've seen a case when a malformed `wlock.break` file prevented the stale lock file from being deleted. It seems unsafe to just delete the `wlock.break`, but we can add more debug messaging before it, so that rerunning a command with `--debug` would tell us what is going on. Reviewed By: quark-zju Differential Revision: D7572510 fbshipit-source-id: 5456ae6dbff3721bbd40c6ed55e173beabac3f65
This commit is contained in:
parent
c8a36c3d0c
commit
e53224ec32
@ -339,12 +339,16 @@ class lock(object):
|
|||||||
# if locker dead, break lock. must do this with another lock
|
# if locker dead, break lock. must do this with another lock
|
||||||
# held, or can race and break valid lock.
|
# held, or can race and break valid lock.
|
||||||
try:
|
try:
|
||||||
l = lock(self.vfs, self.f + '.break', timeout=0)
|
msg = _('trying to removed the stale lock file '
|
||||||
|
'(will acquire %s for that)\n')
|
||||||
|
breaklock = self.f + '.break'
|
||||||
|
self._debugprintonce(msg % breaklock)
|
||||||
|
l = lock(self.vfs, breaklock, timeout=0)
|
||||||
self.vfs.unlink(self.f)
|
self.vfs.unlink(self.f)
|
||||||
l.release()
|
l.release()
|
||||||
self._debugprintonce('removed the stale lock file\n')
|
self._debugprintonce(_('removed the stale lock file\n'))
|
||||||
except error.LockError:
|
except error.LockError:
|
||||||
self._debugprintonce('failed to remove the stale lock file\n')
|
self._debugprintonce(_('failed to remove the stale lock file\n'))
|
||||||
return lockerdesc
|
return lockerdesc
|
||||||
|
|
||||||
def testlock(self):
|
def testlock(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user