Turn off shared-cache mode. Shared-cache is designed for use on itty-bitty-tiny computers with only a few KB of RAM and very paltry CPU resources. On equipment for which shared cache was designed, you are unable to run "intense database actions" on multiple threads, and are therefore unlikely to trip over the additional limitations it imposes.
> -----Original Message----- > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- > bounces at mailinglists.sqlite.org] On Behalf Of Constantine Yannakopoulos > Sent: Thursday, 9 July, 2015 07:45 > To: sqlite-users at mailinglists.sqlite.org > Subject: [sqlite] busy_timeout() not working always? > > ?Hello all, > > I have a multithreaded server that may perform intense database actions > (both reads and writes) concurrently from different threads against two > database connection (sqlite3* objects) to the same database file. The > database connections are in shared-cache mode and I have implemented the > unlock notification mechanism (sqlite3_unlock_notify()) in order to > facilitate table-level locking according to instructions given here: > https://www.sqlite.org/unlock_notify.html. I also use > sqlite_busy_timeout() > to set an internal retry mechanism with a reasonably large timeout value > in > order to avoid SQLITE_BUSY errors. > ?? > > While in rudimentary tests the whole mechanism seems to work as expected, > in normal server operation under heavy load some statements (different > ones > each time) seem to return SQLITE_BUSY immediately, which seems to indicate > that busy_timeout() dos not work in some cases. And this does not change > even if I set the busy timeout to a very large value, e.g. 0x7FFFFFFF > ?, and calling PRAGMA busy_timeout reports the expected value? > . Also, it doesn't seem to have a difference if the database is in WAL or > DELETE mode. > > What may I be doing wrong? Or is there something regarding busy_timeout() > I > have missed? A scenario where it is bypassed? Unfortunately this behaviour > appears only under heavy load in customer sites and is very hard to > reproduce and debug. > > SQLite version is 3.8.10.1, OS is Win7 x64 and the server is compiled in > 32-bit and SQLite is dynamically linked via separate library > (sqlite3.dll), > locking_mode is NORMAL, synchronous is FULL and threading mode is > SERIALIZED. > > Thank you in advance. > -- > Constantine. > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users