[MERGE] Add new LockTimeout exception
John Arbash Meinel
john at arbash-meinel.com
Mon Apr 21 16:20:52 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
| While working on <https://bugs.launchpad.net/bzr/+bug/172392> Jono and I made
| some cleanups to how locks are handled. It turned out that bug did not need to
| be fixed in bzrlib, but I think they are still worth merging.
|
| One is that at present we do not distinguish "waited to get a lock and timed
| out" from "the lock was held by someone else"; doing so would be helpful both
| in testing locks and in cases like the smart server where we don't want to wait.
| This adds the exception and cleans it up in some cases.
|
| I have a followon branch that updates more of tests and fixes some timing
dependencies
| in testing.
|
| Also, the bzr serve command was redundantly disabling waiting for locks.
I don't believe that bzr serve is redundantly disabling waiting for the locks.
Specifically, I only see _DEFAULT_TIMEOUT_SECONDS present in builtins.py (which
you removed), test_lockdir.py and tests/__init__.py
The reason 'bzr serve' was setting the lock timeout was because doing:
bzr SOMETHING bzr+ssh://foobar
was blocking on a lock, but not telling the client that. This meant that it
could hang with no action for 5 minutes (300s) before telling the user that
their branch was locked.
So instead, we made it so the *service* does not block on locks, and possibly
the client does.
So I think you need to re-instate the DEFAULT_TIMEOUT_SECONDS portion of bzr serve.
As for the difference between "waited and timed out" doesn't that mean the lock
is held by someone else? I'm not sure what you are distinguishing. Is this "I
didn't wait at all and the lock was held"?.
If so, maybe just make that clearer from the doc strings, etc. (Change the
docstring for LockContention to indicate that we did not wait for the lock, and
then make it clear in LockTimeout that we did, and the lock was still held.)
| bzr 1.4rc1 2008-04-11
| ---------------------
|
| === modified file 'bzrlib/builtins.py'
| --- bzrlib/builtins.py 2008-04-12 06:46:35 +0000
| +++ bzrlib/builtins.py 2008-04-21 08:13:43 +0000
| @@ -3845,19 +3845,16 @@
| smart_server = server.SmartTCPServer(t, host=host, port=port)
| print 'listening on port: ', smart_server.port
| sys.stdout.flush()
| - # for the duration of this server, no UI output is permitted.
| - # note that this may cause problems with blackbox tests. This should
| - # be changed with care though, as we dont want to use bandwidth sending
| + # for the duration of this server, no UI output is permitted. note
| + # that this may cause problems with blackbox tests. This should be
| + # changed with care though, as we dont want to use bandwidth sending
| # progress over stderr to smart server clients!
| old_factory = ui.ui_factory
| - old_lockdir_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
| try:
| ui.ui_factory = ui.SilentUIFactory()
| - lockdir._DEFAULT_TIMEOUT_SECONDS = 0
| smart_server.serve()
| finally:
| ui.ui_factory = old_factory
| - lockdir._DEFAULT_TIMEOUT_SECONDS = old_lockdir_timeout
|
|
| class cmd_join(Command):
|
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgMsNQACgkQJdeBCYSNAAPkzACfdH5+mTI0XFmpAFj4t6wDQLJZ
ddQAnA6aQfwBkOuK1o7L+l8xUTA54t2l
=WoyT
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list