summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-09-24 17:15:12 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-09-24 17:15:12 +0200
commite43ea9efcfa94ec6459b0ce4a0966cd92dae977a (patch)
treeae5ef50b687bf2c75e9d176be508a0b95bfe1b99
parent949eeee20fe4d91d627e80682aa302904d17b291 (diff)
downloadqutebrowser-e43ea9efcfa94ec6459b0ce4a0966cd92dae977a.tar.gz
qutebrowser-e43ea9efcfa94ec6459b0ce4a0966cd92dae977a.zip
Ignore sqlite locking protocol error
According to https://sqlite.org/rescode.html this error should rarely happen: The SQLITE_PROTOCOL result code indicates a problem with the file locking protocol used by SQLite. The SQLITE_PROTOCOL error is currently only returned when using WAL mode and attempting to start a new transaction. There is a race condition that can occur when two separate database connections both try to start a transaction at the same time in WAL mode. The loser of the race backs off and tries again, after a brief delay. If the same connection loses the locking race dozens of times over a span of multiple seconds, it will eventually give up and return SQLITE_PROTOCOL. The SQLITE_PROTOCOL error should appear in practice very, very rarely, and only when there are many separate processes all competing intensely to write to the same database. However, in practice, this happens for some users during the sqlite initialization (while turning on WAL). Since we can't do anything, this shouldn't be handled as error.
-rw-r--r--doc/changelog.asciidoc2
-rw-r--r--qutebrowser/misc/sql.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index 9ef91d295..4a9cf0982 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -75,6 +75,8 @@ Fixed
number hints on French keyboards.
- With rapid hinting in number mode, backspace now edits the filter text after
following a hint.
+- A certain type of error ("locking protocol") while initializing sqlite now
+ isn't handled as crash anymore.
Removed
~~~~~~~
diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py
index c9b260502..da509fa8c 100644
--- a/qutebrowser/misc/sql.py
+++ b/qutebrowser/misc/sql.py
@@ -43,6 +43,7 @@ class SqliteErrorCode:
CORRUPT = '11' # database disk image is malformed
FULL = '13' # database or disk is full
CANTOPEN = '14' # unable to open database file
+ PROTOCOL = '15' # locking protocol error
CONSTRAINT = '19' # UNIQUE constraint failed
@@ -102,6 +103,7 @@ def raise_sqlite_error(msg, error):
SqliteErrorCode.CORRUPT,
SqliteErrorCode.FULL,
SqliteErrorCode.CANTOPEN,
+ SqliteErrorCode.PROTOCOL,
]
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-70506