On 6 Oct 2017, at 1:55pm, Fahad <fa...@2doapp.com> wrote:

> I can now reliably corrupt my database - and this happens only when some
> other process is writing to the database while I perform sqlite3_close_v2 on
> the connections.

Reliable corruption will help investigation tremendously.  To help investigate 
this ..

What macOS version ?  If you’re not running the 'bash' that comes with it, tell 
us.

What format is the drive the database is stored on in ?  Is it the boot drive 
for that computer ?

Is any part of your test setup still running as a Safari addon/plugin ?

Just for debugging purposes, can you try your program running with the database 
stored on some other drive ?  Perhaps an external spinning disk, or a Flash 
drive.  Does that increase or decrease the frequency of corruption ?

> #define SQLITE_DEFAULT_SYNCHRONOUS 1 // 1: Normal, 2: Full, 3: Extra
> #define SQLITE_TEMP_STORE 3 // always use memory

Just for debugging purposes, can you try removing these ?  Just let SQLite do 
whatever it would do by default.  Does that increase or decrease the frequency 
of corruption ?

> Page 24256: btreeInitPage() returns error code 11
> On tree page 722 cell 1: 2nd reference to page 24256
> On tree page 932 cell 3: 2nd reference to page 24255

This suggests that something has overwritten your database file starting at 
page 24255.  It is a common source of errors reported by SQLite: some other 
part of a program (Safari ?) suddenly decides to write to the wrong file 
handle.  If you have a hex viewer for the Mac (I recommend '0xED.app') you 
could take a look and see if the text starting there looks like your data (i.e. 
preceding pages) or something completely different.

Having received error messages like this, please close all connections to the 
database, then use the shell tool to execute "PRAGMA integrity_check()" and 
check that the database file on disk is corrupt, rather than some in-memory 
version of it accessed by your software.

Simon.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to