On 24 Jul 2014, at 8:21pm, Mayank Kumar (mayankum) <mayan...@cisco.com> wrote:

> Thanks Simon. I found from the code, there are times when our process dies 
> without closing the db , so I will be fixing those.
> 
> Regarding
>> Do you call have a timeout value set before you make the API call which 
>> opens the database ?
> How does this impact the locked db ?

By default, if a process tried to access the database and is locked, SQLite 
immediately returns SQLITE_BUSY or SQLITE_LOCKED and you have to handle the 
problem in your own programming.

If you set a timeout, after finding the database locked, SQLite will wait a 
short while (milliseconds) and then see if the database is unlocked yet.  If 
not, it will was a little longer, then try again.  If still locked it will wait 
a little longer then try again.  It will keep waiting and retrying until the 
timeout period you set has passed.  This is all done inside the SQLite API call 
and you don't have to do any of it inside your own programming.

Many database locking problems are solved by setting a timeout of a couple of 
minutes.

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

Reply via email to