Rev 3962: During branch creation we had some really odd timings wrt lock and unlock. in lp:///~jameinel/bzr/win32-shelve

John Arbash Meinel john at arbash-meinel.com
Mon Jan 26 20:46:43 GMT 2009


At lp:///~jameinel/bzr/win32-shelve

------------------------------------------------------------
revno: 3962
revision-id: john at arbash-meinel.com-20090126204620-gox8qouutcotl15x
parent: john at arbash-meinel.com-20090126202404-fslg2fmsk5zy165u
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32-shelve
timestamp: Mon 2009-01-26 14:46:20 -0600
message:
  During branch creation we had some really odd timings wrt lock and unlock.
  
  It also shows that having DirStateRevisionTree take the lock out itself is not a safe
  operation, as if the containing WT locks/unlocks during the same time frame, the
  DSRT thinks it took out a lock, but the WT it points to has created a new object in the
  meantime.
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2009-01-23 18:29:24 +0000
+++ b/bzrlib/workingtree_4.py	2009-01-26 20:46:20 +0000
@@ -1367,6 +1367,8 @@
                          _control_files=control_files)
         wt._new_tree()
         wt.lock_tree_write()
+        if accelerator_tree is not None:
+            accelerator_tree.lock_read()
         try:
             self._init_custom_control_files(wt)
             if revision_id in (None, NULL_REVISION):
@@ -1408,6 +1410,8 @@
             finally:
                 basis.unlock()
         finally:
+            if accelerator_tree is not None:
+                accelerator_tree.unlock()
             control_files.unlock()
             wt.unlock()
         return wt
@@ -1791,6 +1795,10 @@
             # Shouldn't this lock self._wt as well?
             state = self._wt._current_dirstate()
             if state._lock_token is None:
+                # XXX: This also catches bugs in design, places where we create
+                # a basis_tree and then lock it, without having the containing
+                # WT locked
+                # self._wt._must_be_locked()
                 state.lock_read()
                 # TODO: this code path should probably be deprecated, but most
                 #       likely it is caught by the next path



More information about the bazaar-commits mailing list