sqlite3.OperationalError: unable to open database file

Bug #873412 reported by Gordon Tyler on 2011-10-13
90
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
High
Unassigned

Bug Description

I got the following error when I ran `bzr up` in a bound branch whose parent is a SVN repository:

bzr: ERROR: sqlite3.OperationalError: unable to open database file

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 946, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1150, in run_bzr
  File "bzrlib\commands.pyo", line 699, in run_argv_aliases
  File "bzrlib\commands.pyo", line 721, in run
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 1493, in run
  File "bzrlib\decorators.pyo", line 217, in write_locked
  File "bzrlib\branch.pyo", line 2637, in update
  File "bzrlib\branch.pyo", line 1108, in pull
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\branch.py", line 820, in pull
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\branch.py", line 744, in _update_revisions
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\branch.py", line 521, in last_revision
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\branch.py", line 304, in last_revmeta
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\util.py", line 142, in next
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\util.py", line 124, in _next
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\revmeta.py", line 998, in _iter_reverse_revmeta_mapping_history
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\revmeta.py", line 923, in iter_reverse_branch_changes
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\util.py", line 165, in next
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\metagraph.py", line 263, in next
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\metagraph.py", line 215, in _get_next
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\metagraph.py", line 541, in iter_changes
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\logwalker.py", line 278, in iter_changes
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\logwalker.py", line 372, in _fetch_revisions
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\transport.py", line 494, in get_log
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\logwalker.py", line 209, in __call__
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\cache\sqlitecache.py", line 381, in insert_paths
  File "C:/Program Files (x86)/Bazaar2.4/plugins\svn\cache\sqlitecache.py", line 110, in executemany
OperationalError: unable to open database file

bzr 2.4.0 on python 2.6.6 (Windows-7-6.1.7601-SP1)
arguments: ['bzr', 'up']
plugins: bzrtools[2.4.0], changelog_merge[2.4.0], colo[0.3.1dev],
    explorer[1.2.1], fastimport[0.12.0dev], launchpad[2.4.0], loom[2.2.1dev],
    netrc_credential_store[2.4.0], news_merge[2.4.0], pipeline[1.1.0],
    qbzr[0.21.1], rewrite[0.6.3dev], svn[1.1.0], upload[1.0.1dev],
    wincrypt_credential_store[1.0.0dev1], xmloutput[0.8.7]
encoding: 'cp1252', fsenc: 'mbcs', lang: None

Gordon Tyler (doxxx) wrote :

Do you have any kind of alternative for storing this data other than sqlite? It doesn't seem too reliable.

Gordon Tyler (doxxx) wrote :

BTW, when I ran the command a second time, it completed successfully.

Jelmer Vernooij (jelmer) wrote :

You can use tdb as well, but it requires installing tdb (http://tdb.samba.org/) or disable the cache completely.

Can you reproduce this with bzr-svn trunk? There are some fixes there which make it simply skip the cache if another process already has it open.

Changed in bzr-svn:
status: New → Incomplete
Gordon Tyler (doxxx) wrote :

I can try trunk but I won't really be able to tell whether it's worked or not until the bug decides to re-occur at some point in the future. It's the first time and only time I've seen it, so I don't know what causes it.

Would you say tdb is more reliable than sqlite? Or is bzr-svn's support for tdb better?

trident_job (trident-job) wrote :

I've enter the duplicate bug #901853.

The issue prevent me to checkout a svn repo, and it occurs every time.

trident_job (trident-job) wrote :

Other impossible checkout:

http://delphi-spring-framework.googlecode.com/svn/
http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc

I've just reboot my PC, not used SVN, not even BZR. I(m trying to checkout these modules ... and it fails.
I also tried to clean the cache from SVN before another attempt, but it didn't fix the issue.

Jelmer Vernooij (jelmer) wrote :

Have you tried disabling the cache entirely?

This can be done by setting "use-cache = False" in the relevant section of subversion.conf.

trident_job (trident-job) wrote :

@Jelmer Yes, same issue without cache.
I will test tomorrow on another (clean) PC, just to double check.

Jelmer Vernooij (jelmer) wrote :

You can't get the same error if the cache is disabled, because in that case sqlite is not used at all.

trident_job (trident-job) wrote :

ooops, you're right.
I change the setting in the wrong place.
It works with the cache disabled, but only when I'm checking out the project with https, not just http

Run command: bzr checkout http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc D:\Projets\Ex\D2
bzr: ERROR: Unprintable exception DavRequestFailed: dict={'msg': "REPORT of '/svnroot/dephicodetodoc/!svn/vcc/default': Could not read response body: Une connexion existante a d\xc3\xbb \xc3\xaatre ferm\xc3\xa9e par l'h\xc3\xb4te distant.\r\n (http://dephicodetodoc.svn.sourceforge.net)", '_preformatted_string': None}, fmt='A Subversion remote access command failed: %(msg)s', error=UnicodeDecodeError('ascii', "REPORT of '/svnroot/dephicodetodoc/!svn/vcc/default': Could not read response body: Une connexion existante a d\xc3\xbb \xc3\xaatre ferm\xc3\xa9e par l'h\xc3\xb4te distant.\r\n (http://dephicodetodoc.svn.sourceforge.net)", 111, 112, 'ordinal not in range(128)')

On 01/22/2012 08:37 PM, trident_job wrote:
> ooops, you're right.
> I change the setting in the wrong place.
> It works with the cache disabled, but only when I'm checking out the project with https, not just http
>
> Run command: bzr checkout http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc D:\Projets\Ex\D2
> bzr: ERROR: Unprintable exception DavRequestFailed: dict={'msg': "REPORT of '/svnroot/dephicodetodoc/!svn/vcc/default': Could not read response body: Une connexion existante a d\xc3\xbb \xc3\xaatre ferm\xc3\xa9e par l'h\xc3\xb4te distant.\r\n (http://dephicodetodoc.svn.sourceforge.net)", '_preformatted_string': None}, fmt='A Subversion remote access command failed: %(msg)s', error=UnicodeDecodeError('ascii', "REPORT of '/svnroot/dephicodetodoc/!svn/vcc/default': Could not read response body: Une connexion existante a d\xc3\xbb \xc3\xaatre ferm\xc3\xa9e par l'h\xc3\xb4te distant.\r\n (http://dephicodetodoc.svn.sourceforge.net)", 111, 112, 'ordinal not in range(128)')
It seems to work fine over HTTP here too.

The error message should be more nicely formatted, but in short, this is
SourceForge closing the connection on us so it's probably more of a
server side issue. Can you reproduce this consistently?

Cheers,

Jelmer

Jelmer Vernooij (jelmer) on 2012-01-25
Changed in bzr-svn:
status: Incomplete → Triaged
importance: Undecided → High
tags: added: windows
Artem Sulimov (tsxv) wrote :

Just got this bug on Windows7 x86 (VMware virtual machine under Linux)
while pulling from svn repo.

Bazaar (bzr) 2.5.1
bzr-svn 1.2.2

There was only one instance of bzr running.
May be it's because of VM dealing with files or Antivirus locking sqlite db (MS Security Essentials).

Disabling the cache makes things very slow, so
workaround for me is to change isolation_level in _connect_sqlite3_file(path) in sqlitecache.py
from None to "DEFERRED"

After that bzr-svn works fine with cache.

Zane D. Purvis (zane-purvis) wrote :

I tried Artem's suggestion, and I haven't seen this problem since.

To save some time for someone else trying to find the file, I found it here: Bazaar\plugins\svn\cache\sqlitecache.py

My function definition is now:

def _connect_sqlite3_file(path):
    return sqlite3.connect(path, timeout=20.0, isolation_level="DEFERRED")

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers