bzr log -r branch|ancestor attempt to fetch data in a read only transaction

Bug #144300 reported by Maciej Katafiasz
30
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
Unassigned
Breezy
Triaged
High
Unassigned

Bug Description

$ bzr log -r branch:PATH
A write attempt was made in a read only transaction on LockableFiles(lock, file:///CWD)

Tags: revspec
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 144300] bzr log dies on more fancy revisionspecs with bzr-svn branches

  status triaged
  importance medium

Thanks for the bug report.
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Changed in bzr-svn:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: bzr log dies on more fancy revisionspecs with bzr-svn branches

Also breaks with core bzr.

ganieda:/data/jelmer/bzr-svn/0.4% bzr.dev log -rbranch:http://bazaar-vcs.org/bzr/bzr.dev

<breaks>

Changed in bzr-svn:
importance: Medium → High
description: updated
Revision history for this message
Matthew Fuller (fullermd) wrote :
Revision history for this message
Colin D Bennett (colinb) wrote : bzr: ERROR: bzrlib.errors.ReadOnlyError: A write attempt was made in a read only transaction on KnitPackRepository

I am getting this error using both bzr 1.6b1 and bzr.dev revno:3493 when attempting to do 'bzr log -r branch:X'. Here is what I get:

cdb@tsunami ~/grub/repo/videotest $ ~/src/bzr/bzr.dev/bzr log -r branch:../upstream..
bzr: ERROR: bzrlib.errors.ReadOnlyError: A write attempt was made in a read only transaction on KnitPackRepository('file:///home/cdb/grub/repo/.bzr/repository/')

Traceback (most recent call last):
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/builtins.py", line 1770, in run
    rev1 = revision[0].in_history(b)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/revisionspec.py", line 227, in in_history
    return self._match_on_and_check(branch, revs)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/revisionspec.py", line 206, in _match_on_and_check
    info = self._match_on(branch, revs)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/revisionspec.py", line 763, in _match_on
    branch.fetch(other_branch, revision_b)
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/decorators.py", line 163, in write_locked
    self.lock_write()
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/branch.py", line 1414, in lock_write
    repo_token = self.repository.lock_write()
  File "/home/cdb/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 1988, in lock_write
    raise errors.ReadOnlyError(self)
ReadOnlyError: A write attempt was made in a read only transaction on KnitPackRepository('file:///home/cdb/grub/repo/.bzr/repository/')

bzr 1.6b3 on python 2.5.2 (linux2)
arguments: ['/home/cdb/src/bzr/bzr.dev/bzr', 'log', '-r', 'branch:../upstream..']
encoding: 'ANSI_X3.4-1968', fsenc: 'ANSI_X3.4-1968', lang: None
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.6.0]
  gtk /home/cdb/.bazaar/plugins/gtk [0.95.0dev1]
  launchpad /home/cdb/src/bzr/bzr.dev/bzrlib/plugins/launchpad [unknown]
  usertest /home/cdb/.bazaar/plugins/usertest [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Stewart Smith (stewart) wrote :

using latest bzr.dev:

$ bzr log -r branch:../foo
bzr: ERROR: bzrlib.errors.ReadOnlyError: A write attempt was made in a read only transaction on KnitPackRepository('file:///home/stewart/mysql/.bzr/repository/')

Traceback (most recent call last):
  File "/home/stewart/lib/python/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/stewart/lib/python/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/home/stewart/lib/python/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/stewart/lib/python/bzrlib/commands.py", line 818, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/stewart/lib/python/bzrlib/builtins.py", line 1761, in run
    rev1 = rev2 = revision[0].in_history(b)
  File "/home/stewart/lib/python/bzrlib/revisionspec.py", line 227, in in_history
    return self._match_on_and_check(branch, revs)
  File "/home/stewart/lib/python/bzrlib/revisionspec.py", line 206, in _match_on_and_check
    info = self._match_on(branch, revs)
  File "/home/stewart/lib/python/bzrlib/revisionspec.py", line 763, in _match_on
    branch.fetch(other_branch, revision_b)
  File "/home/stewart/lib/python/bzrlib/decorators.py", line 190, in write_locked
    self.lock_write()
  File "/home/stewart/lib/python/bzrlib/branch.py", line 1466, in lock_write
    repo_token = self.repository.lock_write()
  File "/home/stewart/lib/python/bzrlib/repofmt/pack_repo.py", line 1836, in lock_write
    raise errors.ReadOnlyError(self)
ReadOnlyError: A write attempt was made in a read only transaction on KnitPackRepository('file:///home/stewart/mysql/.bzr/repository/')

bzr 1.6b3 on python 2.5.2 (linux2)
arguments: ['/home/stewart/bin/bzr', 'log', '-r', 'branch:../foo']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_AU.UTF-8'
plugins:
  bzrtools /home/stewart/.bazaar/plugins/bzrtools [1.6.0]
  diffstat /home/stewart/.bazaar/plugins/diffstat [unknown]
  gtk /home/stewart/.bazaar/plugins/gtk [0.95.0dev1]
  launchpad /home/stewart/lib/python/bzrlib/plugins/launchpad [unknown]
  loom /home/stewart/.bazaar/plugins/loom [1.4.0dev0]
  multiparent /home/stewart/lib/python/bzrlib/plugins/multiparent.py [unknown]
  mysql_plugins /home/stewart/.bazaar/plugins/mysql_plugins [0.3.13]
  rebase /home/stewart/.bazaar/plugins/rebase [0.4.0dev0]
  signing /home/stewart/.bazaar/plugins/signing [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
jalitr (jalitr) wrote :

Problem?
=======

In builtins.py, cmd_log.run() calls b.lock_read() which conflicts with
the call to _get_revision_range() which calls branch.fetch() which
needs a write lock.

Solution #1?
===========

Move the call to _get_revision_range() out of the read lock. If
revisions are immutable, it shouldn't matter, but I don't know if they
are or not; however, something similar is done cmd_missing.run() where
_get_revision_range() is called before acquiring a read lock.

Solution #2?
===========

Just change b.lock_read() to b.lock_write().

Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: revspec
Jelmer Vernooij (jelmer)
Changed in bzr:
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer)
Changed in bzr:
assignee: Jelmer Vernooij (jelmer) → nobody
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → High
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.