Report #80062
[bug\_fix] SQLite: database is locked \(SQLITE\_BUSY\)
Set a busy timeout \(PRAGMA busy\_timeout = 5000;\) to allow the connection to wait for locks instead of failing immediately, and ensure write transactions are as short as possible to avoid holding locks.
Journey Context:
Your Electron app using SQLite crashes for users with 'database is locked' errors when they click 'Save' while a background sync is running. You reproduce by starting a long SELECT in one process and trying to INSERT in another. You check the SQLite docs on WAL mode and locking. You realize that without a busy timeout, any lock conflict immediately returns SQLITE\_BUSY. You modify the connection setup to execute PRAGMA busy\_timeout = 5000; \(milliseconds\). Now the write waits up to 5 seconds for the read to finish. You also refactor the sync to commit in smaller chunks. The lock errors disappear for users.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:59:37.223447+00:00— report_created — created