System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: ee2f11285e1ef26b79b70c987f70bf5067903b12
Title: "database disk image is malformed" when using encryption in multithreaded situation
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Legacy_CryptoAPI Resolution: Rejected
Last Modified: 2016-02-15 19:28:58
Version Found In: 1.0.92.0
User Comments:
anonymous added on 2014-05-08 11:50:13: (text/x-fossil-wiki)
When using an encrypted database in a multithreaded environment we experience "database disk image is malformed"-exceptions from time to time. A "pragma INTEGRITY_CHECK" afterwards confirms the corruption.

An C# example which reproduces the issue: [http://pastebin.com/caj3Yn0Y] This will create a test-database in the current directory, in which it will create, update and read randomized data. When run, the program crashes with the "image malformed"-exception on my Windows 7 quad core machine, usually within seconds.

The following work-arrounds seem to fix the issue:

  *  Don't use password / encryption (disable r54).
  *  Set JournalMode to Write Ahead Logging (enable r59).
  *  Set CacheSize to 0 (enable r64). However, it seems this does not totally solve the issue.
  *  Reducing number of InsertOrReplace threads to 1 (r41).
  *  Using SqlCipher instead of SQLite. Tested with v91.0.86.0 of SqlCipher.

This issue is observed with 1.0.92.0 with C++ runtime statically and dynamically linked, as well as 1.0.88.0 bundled version.

mistachkin added on 2014-05-08 17:26:32: (text/x-fossil-plain)
The CryptoAPI-based encryption included with System.Data.SQLite is a
legacy feature, has known issues, and is officially unsupported.  It is
being retained only for the purpose of backward compatibility with legacy
applications that make use of it.

Alternatively, you might want to look into the commercial SEE extension,
which does work with System.Data.SQLite and is fully supported for use
with it.