ObjectNotLocked doing 'bzr log -r 199 path/to/file'

Bug #445171 reported by Andrew Bennetts
54
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Andrew Bennetts
2.0
Fix Released
High
Andrew Bennetts

Bug Description

This can be seen with a branch of bzr in 2a format:

$ bzr log -r 199 NEWS
bzr: ERROR: bzrlib.errors.ObjectNotLocked: <bzrlib.groupcompress._GCGraphIndex object at 0xa2e6a4c> is not locked

Traceback (most recent call last):
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 842, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 1037, in run_bzr
    ret = run(*run_argv)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 654, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 1052, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/andrew/code/bzr/bzrlib/builtins.py", line 2278, in run
    file_list)
  File "/home/andrew/code/bzr/bzrlib/log.py", line 1897, in _get_info_for_log_files
    kind = _get_kind_for_file_id(tree, file_id)
  File "/home/andrew/code/bzr/bzrlib/log.py", line 1929, in _get_kind_for_file_id
    return tree.kind(file_id)
  File "/home/andrew/code/bzr/bzrlib/revisiontree.py", line 148, in kind
    return self._inventory[file_id].kind
  File "/home/andrew/code/bzr/bzrlib/inventory.py", line 2008, in __getitem__
    self.id_to_entry.iteritems([(file_id,)]).next()[1])
  File "/home/andrew/code/bzr/bzrlib/chk_map.py", line 484, in iteritems
    self._ensure_root()
  File "/home/andrew/code/bzr/bzrlib/chk_map.py", line 138, in _ensure_root
    self._root_node = self._get_node(self._root_node)
  File "/home/andrew/code/bzr/bzrlib/chk_map.py", line 151, in _get_node
    bytes = self._read_bytes(node)
  File "/home/andrew/code/bzr/bzrlib/chk_map.py", line 162, in _read_bytes
    bytes = stream.next().get_bytes_as('fulltext')
  File "/home/andrew/code/bzr/bzrlib/groupcompress.py", line 1423, in get_record_stream
    orig_keys, ordering, include_delta_closure):
  File "/home/andrew/code/bzr/bzrlib/groupcompress.py", line 1528, in _get_remaining_record_stream
    locations = self._index.get_build_details(keys)
  File "/home/andrew/code/bzr/bzrlib/groupcompress.py", line 2002, in get_build_details
    self._check_read()
  File "/home/andrew/code/bzr/bzrlib/groupcompress.py", line 1922, in _check_read
    raise errors.ObjectNotLocked(self)
ObjectNotLocked: <bzrlib.groupcompress._GCGraphIndex object at 0xa2e6a4c> is not locked

bzr 2.1.0dev on python 2.6.2 (Linux-2.6.28-15-generic-i686-with-Ubuntu-9.04-jaunty)
arguments: ['/home/andrew/code/bzr/bzr', '-Dhpss', 'log', '-r', '199', 'NEWS']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_AU.UTF-8'
plugins:
  bisect /home/andrew/.bazaar/plugins/bisect [1.1.0.pre.0]
  bzrtools /home/andrew/.bazaar/plugins/bzrtools [2.0.0]
  ec2test /home/andrew/.bazaar/plugins/ec2test [unknown]
  extmerge /home/andrew/.bazaar/plugins/extmerge [unknown]
  gtk /home/andrew/.bazaar/plugins/gtk [0.98.0dev1]
  launchpad /home/andrew/code/bzr/bzrlib/plugins/launchpad [2.1.0dev]
  loom /home/andrew/.bazaar/plugins/loom [1.4.0dev]
  melddiff /home/andrew/.bazaar/plugins/melddiff [unknown]
  netrc_credential_store /home/andrew/code/bzr/bzrlib/plugins/netrc_credential_store [2.1.0dev]
  ping /home/andrew/.bazaar/plugins/ping [unknown]
  pqm /home/andrew/.bazaar/plugins/pqm [1.3.0dev]
  push_and_update /home/andrew/.bazaar/plugins/push_and_update [unknown]
  qbzr /home/andrew/.bazaar/plugins/qbzr [0.15.0dev]
  rebase /home/andrew/.bazaar/plugins/rebase [0.5.2dev]
  removable /home/andrew/.bazaar/plugins/removable [unknown]
  repokeys /home/andrew/.bazaar/plugins/repokeys [unknown]
  stats /home/andrew/.bazaar/plugins/stats [unknown]
  subunit_selftest /home/andrew/.bazaar/plugins/subunit_selftest.py [unknown]
  svn /home/andrew/.bazaar/plugins/svn [1.0.0dev]
  usertest /home/andrew/.bazaar/plugins/usertest [unknown]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Presumably there's a missing lock_read somewhere.

This was originally reported in <https://bugs.edge.launchpad.net/bzr/+bug/389413/comments/5>, but turns out to be a separate bug to bug 389413.

Related branches

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

I have a fix for this, it's pretty shallow. I'll submit it for review for lp:bzr/2.0 shortly.

More interestingly, we *should* have test coverage for this (e.g. blackbox.test_log) but because of the global chk_map page cache the necessary code path is never hit.

Changed in bzr:
assignee: nobody → Andrew Bennetts (spiv)
status: Confirmed → Fix Committed
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 445171] Re: ObjectNotLocked doing 'bzr log -r 199 path/to/file'

On Thu, 2009-10-29 at 04:00 +0000, Andrew Bennetts wrote:
> I have a fix for this, it's pretty shallow. I'll submit it for review
> for lp:bzr/2.0 shortly.
>
> More interestingly, we *should* have test coverage for this (e.g.
> blackbox.test_log) but because of the global chk_map page cache the
> necessary code path is never hit.

Is that a between-test isolation issue, or a 'self.run_bzr doesn't start
clean' isolation issue? Would making run_bzr clear that cache make the
issue become visible?

-Rob

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

Robert Collins wrote:
> Is that a between-test isolation issue, or a 'self.run_bzr doesn't start
> clean' isolation issue? Would making run_bzr clear that cache make the
> issue become visible?

The latter; my patch clears that cache in self.run_bzr now (as you probably
saw).

It turns out this also shook out some bugs in cmd_merge_directive and
cmd_touching_revisions.

Andrew Bennetts (spiv)
Changed in bzr:
status: Fix Committed → Fix Released
John A Meinel (jameinel)
Changed in bzr:
milestone: none → 2.1.0b2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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