vendredi 1 avril 2016

Accessing SQLite database from multiple processes and SQLITE_BUSY

I have multiple processes (c++, Windows 8) that use the same SQLite database. I configured connections with SQLITE_CONFIG_SERIALIZED and PRAGMA busy_timeout = 60000;.

Test scenario:

  • process #1 opens connection, makes reads/writes, sleeps for 5 sec
  • process #2 opens connection, makes reads/writes

After that process #1 failed to use database - it receives SQLITE_BUSY immediate after call to SQLite API (sqlite3_step, sqlite3_finalize). Process #2 still uses the connection without any problems.

I do not have any not closed transactions, I do not have any long operations on the database. What else can lead to this?

I use the same SQLite connection from the multiple threads inside the process. SQLite docs says that this is OK with config option SQLITE_CONFIG_SERIALIZED. Any exception for this rule?

Aucun commentaire:

Enregistrer un commentaire