Frequently, SQLite database files are corrupted (malformed) when used along with C client library to connect to MySQL server.
Source code for the test suite can be found as attachment.
Overview of the sample test code where SQLite corruption is reproducible:
1. Create database files
2. Sets journal mode for all database files to "WAL"
3. Spawns threads
In each thread:
1. Opens the database file
2. Begins SQLite transaction
3. Connects to MySQL server
4. Add a row in SQLite database file
5. Commits SQLite transaction
6. Closes the SQLite database file and repeats step 1
Each thread access only one SQLite database file.
Within few seconds of running the sample test code, the databases appear to corrupt and cannot be used anymore. (with only 25 threads)
If MySQL operations are not involved in the test code, it runs fine and can scale as many as 1000 threads without issues (1000 thread and 1000 SQLite databases).
With MySQL operations, SQLite database files corrupt frequently.