SQLite-related problem with the Signal app
(1) By Simon Slavin (slavin) on 2021-02-28 11:41:37 [source]
I'm posting this here just as a heads-up, and a place to centralise discussion.
There's a github thread on Signal (open source messaging app). It discusses a long-standing problem where the SQLite file used to store message history (and possibly other things) gets corrupted. The corruption affects the first part of the file, including the magic string, therefore SQLite will no longer recognise the file as a SQLite database and refuses to open it with SQLITE_NOTADB.
I've looked at the posts but not the source code. As far as I can tell, something outside SQLite is writing to the database file. In other words, there's no reason to suspect any problem with SQLite itself. Perhaps a more skilled reader of this forum might want to investigate further.
(2) By TripeHound on 2021-02-28 15:07:15 in reply to 1 [link] [source]
Possibly of interest old SQLite mailing-list thread: Feb 06, 2018; 4:57pm Header corruption. One of the first "hypotheses" was that "the rest of the program" might be closing a file, but still writing using the file-descriptor... and in the meantime SQLite had opened a file using that descriptor.
In that particular case (see this post) the problem was similar, but involved sockets (which are close-enough to file-descriptors to trigger/suffer-from the same problem).