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

Bug #144300 reported by Maciej Katafiasz on 2007-09-23
30
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
High
Unassigned

Bug Description

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

  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

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
Matthew Fuller (fullermd) wrote :

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.

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.

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) on 2010-03-18
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer) on 2011-01-15
tags: added: revspec
Jelmer Vernooij (jelmer) on 2011-12-08
Changed in bzr:
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer) on 2012-04-03
Changed in bzr:
assignee: Jelmer Vernooij (jelmer) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers