Comment 3 for bug 185200

Revision history for this message
Wesley J. Landaker (wjl) wrote :

I just ran into this bug myself, probably for the same reason. It would be nice if the database wasn't locked for the entire bzr operation (like a really long branch or checkout) but instead was only locked for the duration of a transaction. I don't know enough about what kind of things are stored in the database to know if this is feasible in the way bzr-svn is using it, but sqlite itself certainly supports this kind of operation.

But, if it's really a permanent limitation of bzr-svn that it can't ever have two instances using the same repository, I'd suggest that the exception should be caught and a more reasonable error message returned. As is, it is a crash and tells the user to report a bug.

Here is the traceback I got, just in case it is informational:

$ bzr co svn+https://...
bzr: ERROR: pysqlite2.dbapi2.OperationalError: database is locked

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 834, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 790, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 1012, in run
    accelerator_tree, hardlink)
  File "/home/wjlanda/.bazaar/plugins/svn/branch.py", line 200, in create_checkout
    return self._create_heavyweight_checkout(to_location, revision_id, hardlink=hardlink)
  File "/home/wjlanda/.bazaar/plugins/svn/branch.py", line 153, in _create_heavyweight_checkout
    checkout_branch.pull(self, stop_revision=revision_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/branch.py", line 1714, in pull
    run_hooks=run_hooks)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/branch.py", line 1513, in pull
    self.update_revisions(source, stop_revision, overwrite=overwrite)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/branch.py", line 1452, in update_revisions
    other_last_revno, other_last_revision = other.last_revision_info()
  File "/home/wjlanda/.bazaar/plugins/svn/branch.py", line 232, in last_revision_info
    last_revid = self.last_revision()
  File "/home/wjlanda/.bazaar/plugins/svn/branch.py", line 264, in last_revision
    return self.repository.generate_revision_id(last_revnum, self.get_branch_path(last_revnum), self.mapping)
  File "/home/wjlanda/.bazaar/plugins/svn/repository.py", line 578, in generate_revision_id
    str(mapping.scheme))
  File "/home/wjlanda/.bazaar/plugins/svn/revids.py", line 118, in insert_revid
    (min_revnum, max_revnum, revid, branch, scheme))
OperationalError: database is locked

bzr 1.3 on python 2.4.5.final.0 (linux2)
arguments: ['/usr/bin/bzr', 'co', 'svn+https://...']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bisect /home/wjlanda/.bazaar/plugins/bisect [1.1.0pre0]
  bzrtools /usr/lib/python2.4/site-packages/bzrlib/plugins/bzrtools [1.3.0]
  cvsps /home/wjlanda/.bazaar/plugins/cvsps [unknown]
  gtk /usr/lib/python2.4/site-packages/bzrlib/plugins/gtk [0.93.0]
  launchpad /usr/lib/python2.4/site-packages/bzrlib/plugins/launchpad [unknown]
  loom /home/wjlanda/.bazaar/plugins/loom [1.3.0dev0]
  rebase /home/wjlanda/.bazaar/plugins/rebase [0.3.0dev0]
  stats /home/wjlanda/.bazaar/plugins/stats [unknown]
  svn /home/wjlanda/.bazaar/plugins/svn [0.4.10dev0]
*** 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.