From 5156feae9d791d9e4686995243c509060cd49406 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 6 Oct 2018 05:06:42 -0400 Subject: [PATCH] Switch sqlite3 journal mode to WAL. WAL mode does make the deadlocking on MacOS go away. This suggests that pysqlite3 was leaving *read* transactions open for a long time; in old-style sqlite journals, this prevents anyone from obtaining a write lock, although it doesn't prevent other concurrent reads. With WAL journals, writes can happen even while readers are holding a lock, but the journal doesn't flush until the readers have released it. This is not a "real" fix but it's fairly harmless, since all redo instances will exit eventually, and when they do, the WAL journal can be flushed. --- state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state.py b/state.py index a321448..b9dd259 100644 --- a/state.py +++ b/state.py @@ -14,7 +14,7 @@ STAMP_MISSING='0' # the stamp of a nonexistent file def _connect(dbfile): _db = sqlite3.connect(dbfile, timeout=TIMEOUT) _db.execute("pragma synchronous = off") - _db.execute("pragma journal_mode = PERSIST") + _db.execute("pragma journal_mode = WAL") _db.text_factory = str return _db