sftp locks can get stuck

John Arbash Meinel john at arbash-meinel.com
Tue Dec 20 03:44:59 GMT 2005


Robert Collins wrote:
> regrettably I just ran into a situation with a
> stale .bzr/branch-lock.write over sftp.
> 
> Is there any mechanism we can use with sftp to ensure that we dont get
> stale locks/can remove them as needed?
> 
> (I.e. write a time stamp and nuke it after 24 hours?)
> 
> Rob
> 
> 

Well, we can check the create time on the lock. We create it O_EXCL, so
we know it was created. We only create them over sftp, so we know that
we have stat access.

I don't know what magical timeout you want to use. Certainly we could do
a "bzr break-lock" sort of a thing.
Any sort of locking we do is going to require being manually broken
(other than a smart server/sftp 6 support, where you can request an OS
level lock).

What would you like? I think we can just catch the lock error, and just
print:
Remote branch is locked: sftp://path/to/foo
Someone else may be using it. If it is a stale lock, use 'bzr
break-lock' to force the lock to be removed.

The problem is that our locks are only advisory, so if someone breaks it
underneath us, we will keep changing things, and 2 programs doing that
have a decent chance of corrupting something.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051219/f031740e/attachment.pgp 


More information about the bazaar mailing list