I have a problem with sqlite3 db that remains locked / unavailable after a certain access.
The behavior is still happening on Ubuntu 10.4 and on user (OpenEmbedded) Linux. The sqlite version is 3.7.7.1). Db is a local file.
One C ++ application periodically accesses db (5s). Each time multiple insert statements are executed wrapped in a pending transaction. This happens in only one thread. Connection with db is maintained throughout the life of the application. Used statements are also stored and reused through sqlite3_reset
. sqlite_threadsafe is set to 1 (serialized), logging is set to WAL.
Then I open in parellel sqlite db using the sqlite command line tool. I enter BEGIN IMMEDIATE;
wait> 5 seconds and commit with END;
.
after that, the db-access of the application does not work: BEGIN TRANSACTION
returns return code 1 ("SQL error or missing database"). If I started ROLLBACK TRANSACTION
just before the start, just to make sure that there is no active transaction yet, it does not work with return code 5 ("Database file is locked").
Does anyone have an idea how to approach this problem or have an idea that might cause it?
EDIT: Workaround: if the error described occurs, I close and reopen the db connection. This fixes the problem, but I donβt understand why this is so.
source share