Other LockError problems with dirstate

John Arbash Meinel john at arbash-meinel.com
Tue Mar 13 23:47:40 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is one case where we currently run into problems with how we lock
the .bzr/checkout/dirstate file, and it happens on all platforms.

Basically, if you run 'bzr commit' in one window, and then try to run
'bzr status' in another, you will get a LockError because one process
has a WriteLock on the file, and the other is trying to get a ReadLock.

I run into this from time to time, because I have gpg signing set up,
and I'll forget that I have it running in another window.

At the very least, I think we need a better error. I've attached the
current output, to show why it isn't really acceptable.

We could at least subclass LockError, and make sure that some form of
LockContention is raised, so we can let the user know that they can try
again later.

I'm still not settled that we shouldn't be replacing the file rather
than taking out OS locks on it. Since it would let us do a 'bzr status'
even while 'bzr commit' is going on in another window, which is
something we used to support. (It shows the uncommitted state, but I've
used it when doing a long development and partial commits to remind me
of what file I need to work on next).

Thoughts? Also, should we be spawning a separate process to lock the
files, so that we can be sure we are testing the right exception?

John
=:->

% bzr st
bzr: ERROR: bzrlib.errors.LockError: Lock error: [Errno 11] Resource
temporarily unavailable

Traceback (most recent call last):
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/commands.py",
line 650, in run_bzr_catch_errors
    return run_bzr(argv)
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/commands.py",
line 612, in run_bzr
    ret = run(*run_argv)
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/commands.py",
line 304, in run_argv_aliases
    return self.run(**all_cmd_args)
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/commands.py",
line 622, in ignore_pipe
    result = func(*args, **kwargs)
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/builtins.py",
line 201, in run
    to_file=self.outf, short=short, versioned=versioned)
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/status.py", line
120, in show_tree_status
    wt.lock_read()
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/workingtree_4.py",
line 556, in lock_read
    state.lock_read()
  File
"/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/dirstate.py",
line 2221, in lock_read
    self._lock_token = lock.ReadLock(self._filename)
  File "/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/lock.py",
line 137, in __init__
    raise LockError(e)
LockError: Lock error: [Errno 11] Resource temporarily unavailable

bzr 0.16.0dev0 on python 2.4.3.final.0 (linux2)
arguments: ['/home/jameinel/bin/bzr', 'st']

** please send this report to bazaar at lists.ubuntu.com
/local/01/system/srv/bzr/public/mirrors/bzr.dev/bzrlib/lock.py:65:
UserWarning: lock on <open file u'/home/jameinel/dev/
bzr/locking/.bzr/checkout/dirstate', mode 'rb' at 0xb79e5920> not released
  warn("lock on %r not released" % self.f)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9zgcJdeBCYSNAAMRAgb8AJ93fMMbfUwdooegauOf5pcnkUKBDgCfQVhn
9J71DIONo/QBFU9s3q/yrRw=
=9Wv6
-----END PGP SIGNATURE-----



More information about the bazaar mailing list