On 10/05/2013 01:55 AM, Sascha Sertel wrote:
Hello everybody,

I'm hoping someone might have some insights on a particular issue I've been
running into. Here some details:

I'm working on a multi-platform app that uses a cross-platform library with
SQLite 3.7.16.1 built into it (i.e. not using the built-in SQLite version
in Android or other platforms). We make (re)use of prepared statements for
INSERT and UPDATE on the database, and we use FULLMUTEX serialized
threading mode. We use explicit transactions for some bulk INSERT
operations, but most other calls use implicit transactions.

Everything worked fine until I switched journal_mode from MEMORY to WAL.
Now when I run the app I started seeing SQLite errors pop up, the first
error is


sqlite3_step failed: unable to open database file (error code: 14)

That error usually indicates that SQLite failed to open
or create some require file. Is there some reason the app
might fail to open or create a *-wal or *-shm file in the
same directory as the database file?

Dan.






and after that I get a lot of follow-up errors from my prepared statements
such as


sqlite3_bind_text failed: library routine called out of sequence
(error code: 21)


This does not happen on iOS or other platforms using the same
cross-platform library, leading me to believe this might be an Android
specific issue, maybe due to VFS differences or something like that.

There are multiple threads in the same process accessing the database, all
using the same shared connection. My understanding is that due to the
FULLMUTEX mode SQLite is serializing all these calls. Now WAL basically
reenables concurrent reads and writes, my suspicion is that the error is
caused by trying to do concurrent writes even though it shouldn't. However,
in that case I would expect to see a database locked error instead of this
weird unable to open database file issue.

Does any of this sound familiar to anyone? I wasn't able to fix it by any
means other than setting journal_mode back, actually all other journaling
modes work fine except WAL. I looked around and couldn't really find much
on people having issues with WAL on Android, so it might be something about
the combination of WAL with prepared statements and FULLMUTEX?

Any help is appreciated!

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

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

Reply via email to