BzrError: Must end write group before releasing write lock on KnitPackRepository

Bug #230902 reported by Forest Bond
26
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Andrew Bennetts
Launchpad itself
Fix Released
High
Unassigned
bzr-svn (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have the .bzr directory saved, so feel free to contact me for more info (fbond on IRC).

Log file:

0.341 encoding stdout as sys.stdout encoding 'UTF-8'
0.346 bzr arguments: [u'-Dhpss', u'pull']
0.346 looking for plugins in /home/forest/.bazaar/plugins
0.348 looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
0.348 Plugin name __init__ already loaded
0.349 Plugin name __init__ already loaded
1.114 encoding stdout as sys.stdout encoding 'UTF-8'
1.866 opening working tree '/home/forest'
2.036 hpss: Built a new medium: SmartSSHClientMedium
2.038 hpss call: 'hello',
2.065 ssh implementation is OpenSSH
8.448 result: 6.410s 'ok', '2'
8.565 hpss call: 'BzrDir.open', 'home/fab/'
8.789 result: 0.222s 'yes',
8.790 hpss call: 'BzrDir.open_branch', 'home/fab/'
8.796 result: 0.006s 'ok', ''
8.796 hpss call: 'BzrDir.find_repositoryV2', 'home/fab/'
8.827 result: 0.031s 'ok', '', 'no', 'no', 'no'
8.997 hpss call: 'Branch.last_revision_info', 'home/fab/'
9.009 result: 0.011s 'ok', '302', '<email address hidden>'
9.012 hpss call: 'get', '/home/fab/.bzr/branch-format'
9.019 result: 0.006s 'ok',
9.019 35 body bytes read
9.020 hpss call: 'get', '/home/fab/.bzr/repository/format'
9.024 result: 0.004s 'ok',
9.025 49 body bytes read
9.026 hpss call: 'stat', '/home/fab/.bzr/repository'
9.034 result: 0.008s 'stat', '4096', '040755'
9.037 hpss call: 'get', '/home/fab/.bzr/repository/pack-names'
9.045 result: 0.008s 'ok',
9.046 589 body bytes read
9.061 Using fetch logic to copy between RemoteRepository(bzr+ssh://<email address hidden>:2222/home/fab/.bzr/)(remote) and KnitPackRepository('file:///home/forest/.bzr/repository/')(<RepositoryFormatKnitPack1>)
9.064 fetch up to rev {<email address hidden>}
9.086 hpss call w/body: 'Repository.get_parent_map', 'home/fab/', '<email address hidden>' ('\n\n0'...)
9.087 3 bytes
9.495 result: 0.408s 'ok',
9.515 10329 body bytes read
9.525 retransmitted revisions: 0 of 411
9.526 Current RemoteRepository graph hit rate: 0%
9.528 Current RemoteRepository graph hit rate: 0%
9.529 Current RemoteRepository graph hit rate: 0%
9.529 Current RemoteRepository graph hit rate: 0%
9.530 Current RemoteRepository graph hit rate: 1%
9.536 Current RemoteRepository graph hit rate: 1%
9.537 Current RemoteRepository graph hit rate: 1%
9.539 Current RemoteRepository graph hit rate: 1%
9.540 Current RemoteRepository graph hit rate: 2%
9.541 Current RemoteRepository graph hit rate: 2%
9.541 Current RemoteRepository graph hit rate: 2%
9.542 Current RemoteRepository graph hit rate: 2%
9.543 Current RemoteRepository graph hit rate: 3%
9.543 Current RemoteRepository graph hit rate: 3%
9.544 Current RemoteRepository graph hit rate: 3%
9.545 Current RemoteRepository graph hit rate: 3%
9.545 Current RemoteRepository graph hit rate: 4%
9.546 Current RemoteRepository graph hit rate: 4%
9.546 Current RemoteRepository graph hit rate: 4%
9.548 hpss call w/body: 'Repository.stream_revisions_chunked', 'home/fab/' ('forest.bond@logicsup'...)
9.548 121 bytes
10.300 result: 0.752s 'ok',
10.301 42 byte chunk read
10.301 396 byte chunk read
10.334 1056 byte chunk read
10.348 6970 byte chunk read
10.375 404 byte chunk read
10.378 371 byte chunk read
10.381 439 byte chunk read
10.387 23058 byte chunk read
10.448 31 byte chunk read
10.450 8787 byte chunk read
10.482 Auto-packing repository <bzrlib.repofmt.pack_repo.RepositoryPackCollection object at 0x109eaeb0>, which has 11 pack files, containing 413 revisions into 8 packs.
10.786 Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 834, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 790, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 652, in run
    possible_transports=possible_transports)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 167, in write_locked
    self.unlock()
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 1144, in unlock
    self.branch.unlock()
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1346, in unlock
    self.repository.unlock()
  File "/usr/lib/python2.5/site-packages/bzrlib/repofmt/pack_repo.py", line 2078, in unlock
    % self)
BzrError: Must end write group before releasing write lock on KnitPackRepository('file:///home/forest/.bzr/repository/')

10.788 return code 3

Tags: lp-code
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

We are having the same error pushing to a shared branch on Launchpad:

bzr: ERROR: Must end write group before releasing write lock on KnitPackRepository('bzr+ssh://<email address hidden>/%7Elaunchpad/launchpad/zope3.4-integration/.bzr/repository/')

Changed in launchpad-bazaar:
status: New → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

mwhudson just reported this as well. In his case it was also during the triggering of an auto-pack.

This has the same root cause as the TooManyConcurrentRequests errors: some code that indiscriminately calls foo.unlock() in a finally clause without taking care to preserve the original exception (if any).

I'm attaching a barely-tested patch that I think probably fixes the case that Francis and mwhudson have encountered. I'm not sure if it'll fix the original reporter's bug as well. We really need to grep the entire codebase for unlock() calls in finally blocks and fix them all up.

Changed in bzr:
assignee: nobody → spiv
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Stuart Bishop (stub) wrote :

With the fix, attempting to push the branch from Bug 278990 gives me this:

$ ~/src/bzr.dev/bin/bzr push
Using saved push location: lp:~stub/launchpad/pending-db-changes
bzr: ERROR: Revision {<email address hidden>} not present in "patch121090.sql-20080212094058-j5r4p768zs6h6thb-1".

Revision history for this message
Andrew Bennetts (spiv) wrote :

A fix for this error is now on the mailing list, waiting for a review. I've proposed it for 1.8.

Stub: file a new bug for the error revealed by this fix. (It's not surprising that there's another exception; this bug is triggered by there already being an exception, so fixing this bug allows the original exception to be reported).

Changed in bzr:
milestone: none → 1.8
status: Confirmed → Fix Committed
Revision history for this message
Stuart Bishop (stub) wrote :

This is happening regularly, and I don't know if it is possible to QA 1.7 properly without the fix. Should this fix go into the 1.7 series? I've now got two stuck branches.

Revision history for this message
John A Meinel (jameinel) wrote :

Just to mention, the original traceback looks like bug #242510, or possibly bug #252821.
The first has been fixed in 1.8, which could be backported to a 1.7.X, etc.

If you do 1 commit and push and it succeeds, then it is bug #242510.

Certainly this bug hides the other traceback, which is what Andrew is working on.

Andrew Bennetts (spiv)
Changed in bzr:
status: Fix Committed → Fix Released
Revision history for this message
Markus Birth (mbirth) wrote :

I have this while trying a svn-import:

$ bzr svn-import --verbose --all svn://localhost/Web/project
Importing branches with prefix /svn://localhost/Web/project/
bzr: ERROR: Must end write group before releasing write lock on KnitPackRepository('file:///home/user/Development/www/co/project/.bzr/repository/')
$

The log shows various 'file.ext' copied from .... messages and then the following crash:

10.592 Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 893, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 839, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 539, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 853, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/__init__.py", line 285, in run
    keep=keep, incremental=incremental)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/convert.py", line 198, in convert_repository
    inter.fetch()
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/fetch.py", line 835, in fetch
    self.target.unlock()
  File "/usr/lib/python2.5/site-packages/bzrlib/repofmt/pack_repo.py", line 1993, in unlock
    % self)
BzrError: Must end write group before releasing write lock on KnitPackRepository('file:///home/user/Development/www/co/project/.bzr/repository/')

10.593 return code 3

bzr is 1.10-1~bazaar1~intrepid1 and bzr-svn is 0.4.16-1~bazaar1~intrepid1.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 230902] Re: BzrError: Must end write group before releasing write lock on KnitPackRepository

  status fixcommitted

This is fixed in the bzr-svn 0.5 branch.
--
Jelmer Vernooij <email address hidden> / https://launchpad.net/~jelmer/
IRC: jelmer / Jabber: <email address hidden>

Changed in bzr:
status: Fix Released → Fix Committed
Jelmer Vernooij (jelmer)
Changed in bzr:
status: Fix Committed → Fix Released
Revision history for this message
Jonathan Lange (jml) wrote :

AFAICT, this bug has been fixed with more recent rollouts of Launchpad. Please re-open if pain persists.

Changed in launchpad-bazaar:
importance: Undecided → High
status: Confirmed → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.