On 22 Jul 2013, at 7:28am, Jesper Baekdahl <j...@gamblify.com> wrote:

> there should not be anything holding a
> lock.

Please check the return values of all the sqlite3_ API calls before the one 
which is getting SQLITE_BUSY, even those which are apparently working.  For 
instance, do not do

        sqlite3_finalize(S)

do at the very least

        assert(sqlite3_finalize(S) == SQLITE_OK)

maybe better still

        if (sqlite3_finalize(S) != SQLITE_OK) {
                do some error-handling here
        }


One you have tracked down the error, you should know that

       if( res == SQLITE_BUSY )
           usleep(1000);

is not a good idea.  SQLite has its own busy-handling code with increasing 
backoff and other cool things. Set your timeout with

<http://www.sqlite.org/c3ref/busy_timeout.html>

and if you're still getting SQLITE_BUSY somewhere, report it to the user and 
quit gracefully.

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

Reply via email to