SQLITE_BUSY error occurs during concurrent writes when switching from locked journal to WAL mode
0 reputation · 12 Apr 2021, 14:48 UTC
SQLITE_BUSY error occurs during concurrent writes when switching from locked journal to WAL mode
The exact moment a connection releases the exclusive lock when transitioning from a locked journal to WAL mode is not defined in the SQLite documentation, causing intermittent SQLITE_BUSY errors even though the database file appears unlocked.
Because the behavior of the sqlite3_busy_handler callback in WAL mode with multiple active writers is ambiguous, applications cannot reliably determine whether the lock is truly held or merely reported as busy.
Additionally, it is unclear whether a read-only connection can safely observe a partially committed transaction after a checkpoint in WAL mode, creating uncertainty for consistency checks.
What is the precise timing of lock release during the journal-to-WAL transition?
Can a read-only connection safely read data after a checkpoint in WAL mode without risking inconsistent observations?
How should applications handle SQLITE_BUSY callbacks when multiple writers are active in WAL mode?