On 18 Aug 2017, at 12:30am, Fahad G <fa...@2doapp.com> wrote:

> I do not have a way to reproduce this just yet, but I've been seeing way too 
> many diagnostic logs from customers where their databases are being corrupt 
> primarily on the Mac (the exact same code is shared between a Mac app, iPhone 
> and iPad) past several months - more so when I switched to WAL and started 
> dedicating a 'reader' connection for all reads, and a 'writer' for all 
> writes. 

I would say that I don’t see anything wrong with your compiler settings and 
PRAGMAs but that doesn’t mean much because I don’t know much about that stuff.

Would like to check and find out some facts.

At what point does your software detect this corruption ?  Is the database okay 
when it’s opened but get corrupted while he program is working ?  Or is the 
corruption in the file on disk and gets noticed immediately after opening ?  
This might help us figure out whether something in your program is stomping on 
SQLite3 memory.

This started happening several months ago ?  Let’s call it May.  Did you change 
development environments or versions of your Dev tools ?  Do you develop in 
Xcode ?  If so, did you start using a new version fo Xcode ?  Is your 
development computer using a stable version of the OS or the latest Developer 
Release we’re not meant to talk about ?

Are your customers using all the same version of macOS and iOS or are they 
varied ?

Does your application use sqlite3_shutdown() when it quits ?  If not, can you 
make this change ?

Do you check the value returned when you close a database connection and show 
an appropriate error message ?

> I read on the forums that mmap could be at fault (as I was using it). 
> Disabling it almost immediately felt that it solved the problem. However I'm 
> still occasionally now getting reports (weekly) of users running into a 
> "database disk image is malformed" error.

You are correct that use of mmap was (rarely) causing corruption and/or false 
reports of corruption.  Current versions of SQLite no longer use mmap because 
of this.  I’m see you’re using the latest SQLite amalgamation version.

The type of corruption done by this bug was not detectable immediately the file 
was opened.  It might only be noticed when the program tried to read a specific 
record or use a specific index.  Is it possible that your users who are still 
reporting corruption are still using databases which were corrupted earlier ?  
In other words the software is no longer corrupting databases but your users 
have 'legacy corruption' in their files ?

Hope some of this helps or another reader can help you.

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

Reply via email to