SQLiteException “database disk image is malformed”
Sergei Dorogin
402

I’ve encountered this problem both in situation when database is really corrupted and in situation when it wasn’t.

Situation when this error can appear with a non-corrupted database is when one tries to access database from multiple processes including both read and writes working intensively on that database. If this is the case you need to add proper locks so only one process will use database at a time. I’ve encountered this problem also when all writes were locked but reads were not — it was thrown on queries that tried to get a count of rows or a sum from sqlite3 database. So aggregation reads also should be locked.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.