sftp locks can get stuck

Martin Pool mbp at sourcefrog.net
Thu Jan 5 08:59:54 GMT 2006


On Mon, 2005-12-19 at 21:44 -0600, John Arbash Meinel wrote:
> 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?)
> > 
> 
> 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.

I think having a timestamp, and a command to break the lock would be a
good idea.  Perhaps even 

  "branch was locked at 2005-12-31 20:22 by user on foohost"

> 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.

Yes.  So if we do want hosting on passive servers, then the format
should ideally be designed to be robust about such things.  (Credit to
Arch here.)  

-- 
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060105/462caa29/attachment.pgp 


More information about the bazaar mailing list