Latest bzr.dev double locks the branch

John A Meinel john at arbash-meinel.com
Fri Feb 10 18:19:21 GMT 2006


I had a friend try to use the latest bzr on windows (it was actually a
branch of my integration...)
It turns out that the new refactoring for splitting out working tree and
repository is causing .bzr/branch-lock to get locked 2 times when
creating a new tree. (Which causes Windows to throw an exception or
cygwin to deadlock).

At the end is the traceback of what is going on.

The function at fault seems to be WorkingTree._write_inventory(), which
locks the branch, and calls self._control_files.put() which also causes
the branch to be locked.

I'm guessing the issue lies in whether WorkingTree is using the Branch's
control files, or whether we are creating our own.

I'm guessing the fault lines in these lines:

 if (isinstance(self.branch._branch_format,
                   (BzrBranchFormat4, BzrBranchFormat5, BzrBranchFormat6))
        # might be able to share control object
        and self.branch.base.split('/')[-2] == self.basedir.split('/')[-1]):
        self._control_files = self.branch.control_files

I don't understand why it is doing "self.branch.base.split('/')[-2] ==
self.basedir.split('/')[-1]".

To me, that looks very wrong. We would need the entire path to match,
not just one entry. I'm not sure why the -1 vs -2, perhaps one has a
final slash or not.

But that would at least mean we want [:-1], and [:-2]. Since I'm pretty
sure Robert put the code in there, it would be nice if he could clarify
what his intention is for that part of the code. (And if he's really
nice he could propose a fix so that bzr will work on Windows again).

John
=:->

> write locking LockableFiles(branch-lock, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 49, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 870, in lock_write
>     return self.branch.lock_write()
>   File "bzrlib/branch.py", line 874, in lock_write
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 179, in lock_write
>     traceback.print_stack()
> write locking LockableFiles(README, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 49, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 870, in lock_write
>     return self.branch.lock_write()
>   File "bzrlib/branch.py", line 875, in lock_write
>   File "bzrlib/repository.py", line 116, in lock_write
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 179, in lock_write
>     traceback.print_stack()
> write locking LockableFiles(branch-lock, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 51, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 1018, in _write_inventory
>     self._control_files.put('inventory', sio)
>   File "bzrlib/decorators.py", line 49, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 179, in lock_write
>     traceback.print_stack()
> unlocking LockableFiles(branch-lock, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 51, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 1018, in _write_inventory
>     self._control_files.put('inventory', sio)
>   File "bzrlib/decorators.py", line 53, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 212, in unlock
>     traceback.print_stack()
> unlocking LockableFiles(README, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 53, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 1010, in unlock
>     return self.branch.unlock()
>   File "bzrlib/branch.py", line 884, in unlock
>   File "bzrlib/repository.py", line 122, in unlock
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 212, in unlock
>     traceback.print_stack()
> unlocking LockableFiles(branch-lock, /Users/jameinel/dev/bzr/vimdiff/.bzr/)
>   File "./bzr-escape-stores/bzr", line 66, in ?
>     sys.exit(bzrlib.commands.main(sys.argv))
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 581, in main
>     ret = run_bzr_catch_errors(argv[1:])
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 589, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 551, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/builtins.py", line 592, in run
>     br_from.clone(to_location, revision_id, basis_branch)
>   File "bzrlib/branch.py", line 1103, in clone
>   File "bzrlib/decorators.py", line 38, in decorated
>   File "bzrlib/branch.py", line 1080, in _clone_weave
>   File "bzrlib/symbol_versioning.py", line 65, in decorated_function
>   File "bzrlib/branch.py", line 173, in initialize
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 344, in create_standalone
>     return WorkingTree.create(b, directory)
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 326, in create
>     wt._write_inventory(inv)
>   File "bzrlib/decorators.py", line 53, in decorated
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/workingtree.py", line 1010, in unlock
>     return self.branch.unlock()
>   File "bzrlib/branch.py", line 885, in unlock
>   File "/Users/jameinel/dev/bzr/bzr-escape-stores/bzrlib/lockable_files.py", line 212, in unlock
>     traceback.print_stack()

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


More information about the bazaar mailing list