GNOME Bugzilla – Bug 765515
Crash and/or search results not highlighted, "database disk image is malformed" in debug log
Last modified: 2016-10-13 04:02:48 UTC
Created attachment 326656 [details] Example error log Occasionally, search highlights missing from a search result, and "Error highlighting search results: ... - database disk image is malformed" is reported in the debug log. Seems the issue might be the use of 'offsets()' in the Geary.ImapDB.Account::do_get_search_matches query occasionally flaking out: > sqlite> SELECT docid, offsets(MessageSearchTable) FROM MessageSearchTable WHERE docid IN (757) AND MessageSearchTable MATCH 'fr*'; > Error: database disk image is malformed > sqlite> SELECT docid FROM MessageSearchTable WHERE docid IN (757) AND MessageSearchTable MATCH 'fr*'; > 757 Here, docid 757 contains several strings that match "fr*", and also has some empty columns (attachment, cc, bcc), which looks like a SQLIte issue in earlier versions, i.e.: <http://sqlite.1065341.n5.nabble.com/regression-in-FTS3-offsets-function-in-3-6-23-td15216.html> and <http://www.sqlite.org/src/info/9861b74ab9>. Since I am using SQLite 3.11.0 this may be a regression, although I can't reproduce the issue in the same way as in the nabble post above with this version, even when using unicodesn as the tokeniser.
This is also causing segfaults:
+ Trace 236217
Here, in ::do_get_search_matches, the int64 returned for the 1st column (the docid") is non-null, the string returned for the 2nd column (offsets) is null, hence (?) the value of offset_string[0] is null and int.parse() segfaults. Executing the same query from the sqlite command line results in a number of results being returned before the "database disk image is malformed" error eventually crops up. So presumably we get an error returned for the row when this occurs for the first result, but none when it occurs for the second or subsequent result?
Created attachment 327133 [details] [review] Workaround for the crash
Adam, this workaround seems to work fine - can you also commit this, but leave the bug open for now.
OK - I pushed the workaround to master.
Closing this, since the workaround has been committed it looks like the root cause has been identified over in Bug 772522.