From e43ea9efcfa94ec6459b0ce4a0966cd92dae977a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 24 Sep 2019 17:15:12 +0200 Subject: 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. --- doc/changelog.asciidoc | 2 ++ qutebrowser/misc/sql.py | 2 ++ 2 files changed, 4 insertions(+) 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 -- cgit v1.2.3-54-g00ecf