When I try to read (select) from sqlite database from ~1000 processes i keep getting errors like
SQL error: database disk image is malformed
or less often
SQL error: file is encrypted or is not a database
from some of threads.
I test this program & db on 3 hosts:
DB is always in /tmp/ folder so it's basically held in RAM. Integrity check says DB is fine.
What can cause this problem and is there a solution?
Solved. Problem was due to connection to database was opened before fork(). Many processes used one connection. Now it's opened after fork() and everything is ok.
Sqlite3 provides support to multiple selects at the same time only in the case of multiple connections to this db. In this case multiple processes were trying to query db through the same connection. On slower hosts it wasn't a problem but on newer machines probably process run too quickly and previous queries were overwritten/interrupted by new ones. Just guessing :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With