Hello,

I'm working on a C++ application under WinCE (file system is TexFAT), with 
SQLite (actually version 3.6.11, but phenomenon is reproduced with 3.6.23) 
with the following C++ wrapper : 
http://www.alhem.net/project/sqlite/index.html . There's only one database 
with three tables (file is around 40KB, not so many entries!).
The application has two same priority threads (and also the main thread of 
the application) , one is only reading the DB, the second one is reading 
or writing. (Because of some constraints, I cannot store many writings in 
order to do them at once using only one transaction, so I have to do each 
one of them as soon as possible).
The C++ wrapper handles concurrent accesses through a Mutex (both threads 
are naturally using the same Database instance) : each new Query object 
locks the Database instance (and unlocks it in destructor). Then, there 
can't be two Query instances at a time refering to the same Database (I 
checked with traces & asserts, everything is correct).

My problem is the following : some writings or readings fail : SQLite 
returns the SQLITE_BUSY error.

I found on SQLite website that locking mecanism is available with 
THREADSAFE preprocessor flag set at 1, but even then I can reproduce the 
issue.
Also, I've changed the db opening from sqlite3_open to sqlite_open_v2 with 
flags (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX) 
: still unsuccessful...

Do you have any suggestion, as I'm getting stuck ?

[Additionnal question : I've developped a test application in order to 
reproduce the above case. Once I stop this application, and thus the two 
threads accessing the db, I can see the journal file being created/deleted 
for seconds, depending on how long I kept the threads alive. As the C++ 
wrapper is fully synchronous, I don't understand why there are still 
accesses to the db! Is there any cache mecanism into SQLite ?]

Thanks in advance for any answer !
Best regards,
Aymerik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to