On 09/15/2017 10:38 AM, Fahad wrote:
I tried it with sqlite3_shutdown(), didn't help. I was able to reproduce it again using the main app and the safari share plugin.
You don't need to call sqlite3_shutdown(). All it does is release the resources allocated by sqlite3_initialize() - which are trivially small for a workstation app and in any case are released automatically when the process is closed.
Main App: Finished writing to db, just opened a new connection to read (after opening a connection I set PRAGMA query_only=1; PRAGMA read_uncommitted=1; and register some custom functions).
The two pragmas are benign but likely no-ops. "PRAGMA read_uncommitted" only affects shared cache connections, and "PRAGMA query_only" doesn't change the behaviour of read-only connections.
The connection opened fine however the moment the app ran a SELECT statement I think it coincided with a write from the the Plugin (separate process; it opens a connection, writes and then closes it), boom the -shm file vanished and only the .db and .db-wal files were present in the folder. The -wal was zero bytes. I have a feeling the -shm file got deleted by the plugin while it was in fact in use by the main app (the main app only releases all its connections when closing, so at any given time it has at least one open connection, even when not being used).
What is the "safari share plugin"? The only reference to it on the internet seems to be here:
http://webcache.googleusercontent.com/search?q=cache:aIggi9ZiFkoJ:appshopper.com/mac/productivity/2do+&cd=1&hl=en&ct=clnk&gl=th "Fixed an issue with the Safari share plugin, which would at times corrupt the database". A similar problem perhaps. Is your database stored on a network file-system? Have you read this? https://www.sqlite.org/howtocorrupt.html Dan. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users