Hi

A busy_timout is honored by write commands outside of transactions and by 
single write commands inside transactions, but not if preceded by a read 
command. I did not find this behaviour in the documentation, thus it might be a 
bug.

To reproduce (in a linux terminal):
   sqlite3 ~/test.db "CREATE TABLE t(a);"
   echo '.timeout 5000' > ~/sqlitetest.init
   sqlite3 ~/test.db --init ~/sqlitetest.init "BEGIN IMMEDIATE TRANSACTION; 
SELECT * FROM t; INSERT INTO t VALUES(1); COMMIT;"
   sqlite3 ~/test.db --init ~/sqlitetest.init "BEGIN TRANSACTION; INSERT INTO t 
VALUES(1); COMMIT;"
   sqlite3 ~/test.db --init ~/sqlitetest.init "BEGIN TRANSACTION; SELECT * FROM 
t; INSERT INTO t VALUES(1); COMMIT;"
The three sqlite3 commands return immediately without error as the database is 
not locked.

Now lock the database in a second linux terminal
   sqlite3 ~/test.db
   sqlite> BEGIN IMMEDIATE TRANSACTION;

Then repeat the three sqlite3 commands in the first terminal. The first two 
commands take 5 seconds to return, as expected (due to busy_timeout). However, 
the last sqlite3 command returns immediately. Acquiring an exclusive lock prior 
to 'INSERT ...' apparently ignores the busy_timeout.

Best regards

Andreas

PS: I use SQLite version 3.27.2 2019-02-25 16:06:06 on raspbian / buster

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to