When geary.db is large, vacuum-ing fails, leaving the mailbox empty until next restart
Bug Summary
When the database is large, Geary silently fails the VACUUM operation, leaving the mailbox empty until next restart.
Your installation
Geary version: 40.alpha
Geary revision: mainline~g5819012d
GTK version: 3.24.23
GLib version: 2.66.1
WebKitGTK version: 2.30.1
Desktop environment: GNOME
Distribution name: Arch Linux
Distribution release:
Installation prefix: /usr
Steps to reproduce
- Start Geary with a large database (this happened to me with two mailboxes with a geary.db of 11 GB and 2.4 GB).
- Wait for Geary to trigger the vacuuming (this seems to happen after a few minutes in my case)
What happened?
The affected mailboxes became inaccessible while the other one kept working as usual.
What did you expect to happen?
Geary either successfully carrying out the vacuuming or ensures that the mailbox remains accessible
Relevant logs and/or screenshots
A number of relevant lines appeared in the log.
[deb] 14:44:59.0342 Geary.Db: [account_02] [/home/mederic/.local/share/geary/account_02/geary.db, is_open: true] GearyImapDBDatabase: VersionedDatabase.upgrade: current database schema for /home/mederic/.local/share/geary/account_02/geary.db: 28
[deb] 14:44:59.0346 geary:imap-db-gc.vala:104: [GC:/home/mederic/.local/share/geary/account_02/geary.db] GC state: last_reap_time=2020-09-27T07:06:56-0300 last_vacuum_time=never reaped_messages_since=3703 free_page_bytes=1149071360
[deb] 14:44:59.0347 geary:imap-db-gc.vala:131: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Reaping last completed on 2020-09-27T07:06:56-0300 (9 days ago)
[deb] 14:44:59.0347 geary:imap-db-gc.vala:141: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Database never vacuumed (3703 messages reaped)
[deb] 14:44:59.0347 geary:imap-db-gc.vala:164: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Recommending database vacuum: 3703 messages reaped since last vacuum 0 days ago, 1149071360 free bytes in file
[deb] 14:44:59.0347 Geary.Db: [account_02] [/home/mederic/.local/share/geary/account_02/geary.db, is_open: true] GearyImapDBDatabase: Flagging desire to GC vacuum
[deb] 14:50:10.0897 geary:imap-db-gc.vala:104: [GC:/home/mederic/.local/share/geary/account_02/geary.db] GC state: last_reap_time=2020-09-27T07:06:56-0300 last_vacuum_time=never reaped_messages_since=3703 free_page_bytes=1149071360
[deb] 14:50:10.0899 geary:imap-db-gc.vala:131: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Reaping last completed on 2020-09-27T07:06:56-0300 (9 days ago)
[deb] 14:50:10.0899 geary:imap-db-gc.vala:141: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Database never vacuumed (3703 messages reaped)
[deb] 14:50:10.0899 geary:imap-db-gc.vala:164: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Recommending database vacuum: 3703 messages reaped since last vacuum 0 days ago, 1149071360 free bytes in file
[deb] 14:50:11.0668 geary:imap-db-gc.vala:197: [GC:/home/mederic/.local/share/geary/account_02/geary.db] Starting vacuum of IMAP database
[msg] 14:50:12.0696 Geary.Db: [account_02] [/home/mederic/.local/share/geary/account_02/geary.db, is_open: true] GearyImapDBDatabase: Vacuum of IMAP database /home/mederic/.local/share/geary/account_02/geary.db failed: (Connection.exec_file /home/mederic/.local/share/geary/account_02/geary.db) [err=13] - database or disk is full (VACUUM)
After this clicking on the different folders always generated that message (same for account_01 and account_02):
*[wrn] 14:53:52.0888 Geary.Conv: [account_01] [>INBOX, open_count=2, remote_opened=false] [size=0, min_window_count=50, can_load_more=true, should_load_more=true] GearyAppConversationMonitor: Unable to add emails to conversation: GearyOutboxFolder(>$GearyOutbox$) not open
It seems that this is a limitation from SQLite when it runs out of space. However my home directory has over 90 GB of space left and /tmp had 32 GB free, so it is unclear what directory SQLite tried to used. I could work around this bug by using the SQLITE_TMPDIR environment variable to point to a a temporary directory in my home. The geary.db size diminished by the amount stated in the log. However, and if it all controllable by Geary, I think it would be preferable that Geary handles the situation more gracefully and ensure that the mailbox remains accessible in case of failure.