Hi all - I am seeing a strange problem where I have multiple threads trying
to both do writes to the database, and one thread gets back an immediate
SQLITE_BUSY even though *both* have set the busy handler to 10 seconds, and
the write operation is much much faster than this (on the order of
milliseconds).

Both threads open handles to the same database, *both* set the busy_handler
to 10 seconds. In my test program, they do the following:


DB1 -> INSERT OR REPLACE INTO ...   (single row replace, in a table of just
1 row).

DB2 -> BEGIN TRANSACTION
DB2 -> DELETE FROM ...   (the table it operates on is actually empty)
DB2 -> END TRANSACTION

Often times DB2 will return a SQLITE_BUSY when trying to step() the DELETE
statement.  I understand that the first thread, DB1, is writing the database
at this time, but what I don't get is why the busy-handler isn't being
invoked here?? Shouldn't the busy handler take care of the fact that DB1 is
writing, so after it's done, DB2 will be allowed to finish its write
transaction?  Why do I get back an immediate SQLITE_BUSY in this case?

Thanks for any help,

Dave

Reply via email to