Bug 352701 - Kontact forgets how to download messages
Summary: Kontact forgets how to download messages
Status: RESOLVED WORKSFORME
Alias: None
Product: kontact
Classification: Applications
Component: mail (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-14 17:49 UTC by testcore
Modified: 2022-12-10 05:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description testcore 2015-09-14 17:49:58 UTC
After a short period of use after login, Kontact/KMail stops doing its f*in job and won't download messages.  Instead, the placeholder "Retrieving folder contents" page appears indefinitely.

kill -9'ing and restarting akonadi sometimes helps, but this isn't evan actually solved every time  - even by a reboot.  Restarting akonadi & kontact enables the contents of one message to be loaded - proving they can in fact be read - but accessing any other email in the same inbox results in that goddamn "Retrieving..." message.

Happens with at least two different account types - a kolab account and an imap account talking to office365.  Both mail servers are known to be online and can be reached via telnet.  But when kontact claims to be sending/receiving, its lie is exposed by the lack of traffic over the interface - i.e. kontact claims to be syncing, but wireshark captures zero packets destined for either mail server.  What the fuck?!?

This is with the 4.14.10 version of Kontact as distributed by ArchLinux.

Reproducible: Always

Steps to Reproduce:
1.  Add Accounts for Kolab and Office365 to Kontact via the standard interfaces
2.  Use the accounts for a while, note they work fine
3.  Upgrade at some point to 4.14.x; note that kontact forgets how to do its fucking job.

Actual Results:  
Kontact does not retrieve email messages.  Kontact doesn't even ATTEMPT to contact the mail servers.

Expected Results:  
Kontact does retrieves email messages, or at least sends a fucking TCP SYN to the mail server(s).
Comment 1 Orion 2015-09-17 13:28:59 UTC
using Kubuntu 15.10 Beta, latest Plasma 5 release
KMail says version 4.81 Beta 1

configured IMAP access to office365.com resulting in folders being created and KMail (and akonadi) reports mail fetching starts. Gets stuck and no mail is being fetched.

expected result: mail being fetched for offline (or non offline) use

Note: it works as expected in KMail 4.14.2 on Kubuntu 14.10 (KDE same version)
Comment 2 Oliver Kurz 2017-01-12 14:40:13 UTC
I seem to have same or similar symptoms some times but not as often as reported in comment 0. kmail stops to show emails but instead shows the background window where the message preview should appear with the text "Retrieving folder contents" shown.

~/.xsession-errors-:0 shows me

```
Connection broken with state 4 and error: "Unknown error"
```

multiple times during that time.

Version tested is KMail 5.3.0 on openSUSE Leap 42.2. Package version 16.08.2-1.1.
Comment 3 Nick 2017-09-15 08:53:48 UTC
And me, I get this same error. Retrieving folder contents please wait. This bug has been around for years. Kmail/akonadi has been working for me ok for a couple of months but now I just get this inability to read a email. Perhaps it's related to quantity of emails stored that makes it more likely to trigger this bug ? Who knows :-/ In the past I think I've deleted the akonadi database file and configs and started again but it's such a pain to keep doing that. Looking at the logs this seems to be the problem "Cannot connect to agent instance with identifier 'akonadi_maildir_resource_0', error message: ''"
Comment 4 Nick 2017-09-15 09:15:27 UTC
This fixed it for me .. (until the next time the akonadi database gets corrupted)

This involves removing the old akonadi database and letting akonadi construct and reindex a new one.

First exit kmail
then as normal user
akonadi stop

mv /home/jbloggs/.local/share/akonadi /home/jbloggs/.local/share/akonadi.orig
(This is where akonadi stores it's mysql database)

akonadi start

You may get the following messages, but then nothing while it's reindexing.
akonadictl start
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
nick@nick-X681X:~/.local/share$ /usr/bin/mysqlcheck: Got error: 1049: Unknown database 'akonadi' when selecting the database
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
"No file selected."
org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Failed to fetch the resource collection."
org.kde.pim.maildispatcher: Failed to get outbox folder. Retrying in:  5000
org.kde.pim.akonadicore: Failed to request resource "akonadi_maildir_resource_0" : "Failed to fetch the resource collection."
org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Failed to fetch the resource collection."
org.kde.pim.akonadicore: Failed to request resource "akonadi_maildir_resource_0" : "Failed to fetch the resource collection."
org.kde.akonadi.ETM: GEN true false false
org.kde.akonadi.ETM: collection: QVector()
org.kde.akonadi.ETM: 
org.kde.akonadi.ETM: Fetch job took  31 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 0
org.kde.akonadi.ETM: collection: QVector()
org.kde.akonadi.ETM: Fetch job took  39 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 2
org.kde.akonadi.ETM: first fetched collection: "Search"
org.kde.akonadi.ETM: Fetch job took  2 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 0
org.kde.akonadi.ETM: GEN true false false
org.kde.akonadi.ETM: collection: QVector()
org.kde.akonadi.ETM: 
org.kde.akonadi.ETM: Fetch job took  39 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 0
org.kde.akonadi.ETM: collection: QVector()
org.kde.akonadi.ETM: Fetch job took  42 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 2
org.kde.akonadi.ETM: first fetched collection: "Search"
org.kde.akonadi.ETM: Fetch job took  1 msec
org.kde.akonadi.ETM: was collection fetch job: collections: 0
Pass a valid window to KWallet::Wallet::openWallet().
"Unable to fetch item from backend (collection -1) : Unable to retrieve item from resource: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."

To completely reindex akonadi may take a considerable time especially if you have tens of thousands of emails. In my case it's still indexing after an hour. However I can access my emails during this time.

looking at the process list with 'top' mysqld shows at 70-95% on my system during this reindexing period.

If it all goes ok then remove the backup you made.
rm /home/jbloggs/.local/share/akonadi.orig

I don't use kontact or any Calendar so can't comment on what will happen to any data you've entered in those apps however if like me you just use kmail then this worked fine. In kmail it retained the various folders and filters I'd created. And it now works without getting the annoying please wait retrieving folder contents.

Because I made a backup of the original database I noticed that there were a few mysql errors in the log, reproduced below. In particular the error that stands out is this one (with lots of variations.. but basically native table has the wrong structure.

[ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure

more mysql.err
170915  0:46:57 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

170915  0:46:57 [Note] InnoDB: Using mutexes to ref count buffer pool pages
170915  0:46:57 [Note] InnoDB: The InnoDB memory heap is disabled
170915  0:46:57 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
170915  0:46:57 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
170915  0:46:57 [Note] InnoDB: Compressed tables use zlib 1.2.8
170915  0:46:57 [Note] InnoDB: Using Linux native AIO
170915  0:46:57 [Note] InnoDB: Using CPU crc32 instructions
170915  0:46:57 [Note] InnoDB: Initializing buffer pool, size = 128.0M
170915  0:46:57 [Note] InnoDB: Completed initialization of buffer pool
170915  0:46:57 [Note] InnoDB: Highest supported file format is Barracuda.
170915  0:46:57 [Note] InnoDB: 128 rollback segment(s) are active.
170915  0:46:57 [Note] InnoDB: Waiting for purge to start
170915  0:46:58 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.0 started; log sequence number 5061252276
170915  0:46:58 [Note] Plugin 'FEEDBACK' is disabled.
170915  0:46:58 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
170915  0:46:58 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
170915  0:46:58 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_user_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_account_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'host_cache' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'objects_summary_global_by_type' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'setup_actors' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'setup_objects' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_index_usage' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_table' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'table_lock_waits_summary_by_table' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_current' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_history' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_history_long' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_thread_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_account_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_user_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_host_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_stages_summary_global_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_current' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_history' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_history_long' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_thread_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_account_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_user_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_host_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_global_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
170915  0:46:58 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure
170915  0:46:58 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist
170915  0:46:58 [Note] Reading of all Master_info entries succeded
170915  0:46:58 [Note] Added new Master_info '' to hash table
170915  0:46:58 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.0.31-MariaDB-0ubuntu0.16.04.2'  socket: '/tmp/akonadi-nick.R5c8TJ/mysql.socket'  port: 0  Ubuntu 16.04
2017-09-15 00:46:58 7fe2fc6de700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
170915  0:52:39 [Warning] Aborted connection 5 to db: 'akonadi' user: 'nick' host: '' (Got an error reading communication packets)
170915  8:30:23 [Note] /usr/sbin/mysqld: Normal shutdown

170915  8:30:23 [Note] InnoDB: FTS optimize thread exiting.
170915  8:30:23 [Note] InnoDB: Starting shutdown...
170915  8:30:23 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
170915  8:30:24 [Note] InnoDB: Shutdown completed; log sequence number 5985427122
170915  8:30:24 [Note] /usr/sbin/mysqld: Shutdown complete
Comment 5 Nick 2017-09-15 09:28:04 UTC
Regarding the native table has the wrong structure error. Here's a link that references this mysql error here https://dev.mysql.com/doc/refman/5.5/en/performance-schema-build-configuration.html
Comment 6 Nick 2017-09-15 09:35:23 UTC
Interesting regarding the mysql performance schema issue. I do remember doing a very large update prior to this problem that maybe includeded a mysql update. Could the fix have been as simple as running mysql_upgrade as described below ?

If you install MySQL over a previous installation that was configured without the Performance Schema (or with an older version of the Performance Schema that may not have all the current tables), run mysql_upgrade after starting the server to ensure that the performance_schema database exists with all current tables. Then restart the server. One indication that you need to do this is the presence of messages such as the following in the error log:

[ERROR] Native table 'performance_schema'.'events_waits_history'
has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history_long'
has the wrong structure
...
Comment 7 Nick 2017-09-15 09:47:33 UTC
Doing a more /var/log/apt/history.log | grep mysql I can see that akonadi-backend-mysql was updated just before I started getting this problem. I'm almost certain that's what messed up the mysql database and was the answer to run mysql_upgrade as described here ? https://dev.mysql.com/doc/refman/5.5/en/performance-schema-build-configuration.html

At least I'm feeling a little more confident about the akonadi-backend-mysql update having triggered this problem.
Comment 8 Nick 2017-09-15 09:53:16 UTC
Interesting

Quote
You should execute mysql_upgrade each time you upgrade MySQL.

https://dev.mysql.com/doc/refman/5.7/en/mysql-upgrade.html
Comment 9 Nick 2017-09-15 10:01:31 UTC
BTW I'm running KDE Neon LTS 5.8
KDE Plasma Version 5.8.7
KDE Frameworks Version 5.38.0
QT Version 5.7.1
Kernel Version 4.10.0-33-generic
OS Type 64-bit

Processors 8x Intel Core I7 @ 2.2GHz
Memory 16GB
Comment 10 Nick 2017-09-15 11:27:08 UTC
And if you have rebuild your database but find new mail isn't showing up in the inbox then this is the fix.

You will need to correct the destination folders in any filters you created in kmail as they are now probably pointing to the wrong folders. In kmail [Settings]>[Configure Filters] and if the filter uses a 'move into folder' action, check it's moving to the correct folder.

This also applies to any account destination folders, ie my gmail pop3 account was saving into a zoneminder folder I'd created. In kmail, [Settings]>[Configure Kmail]>[Accounts]>[Receiving Tab] click on your account, check destination folder.
Comment 11 Justin Zobel 2022-11-10 08:52:06 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 12 Bug Janitor Service 2022-11-25 05:16:00 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2022-12-10 05:13:17 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!