Bug 362715

Summary: Imap constant refresh of IMAP directory
Product: [Frameworks and Libraries] Akonadi Reporter: Michael Butash <michael>
Component: IMAP resourceAssignee: Christian Mollekopf <chrigi_1>
Status: RESOLVED WORKSFORME    
Severity: normal CC: kdepim-bugs, vkrause, zhx
Priority: NOR    
Version: 5.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michael Butash 2016-05-05 19:26:41 UTC
I'd upgraded from 14.04 ubuntu to 16.04, and with it kde5.  I've been attempting to migrate from thunderbird to kmail, but tying in my primary account, began noticing it having problems with constantly synching, particularly one directory.  I get a count mismatch every time, and it just starts over, which happens to be some 26k messages from some perpetual customer spam in the past year.

Starting and stopping akonadi from cli, I see it hitting the same directory constantly that the local count mismatch doesn't match, tries again, over and over:

log_imapresource: Detected inconsistency in local cache, we're missing some messages. Server:  26320  Local:  25004
log_imapresource: Refetching complete mailbox.

It begins its fetch, gets to the end:

...
Received:  11 In total:  24989  Wanted:  25098
Received:  11 In total:  25000  Wanted:  25098
Wrote 4357 bytes to  "/home/$dir/.local/share/akonadi/file_db_data/26/1088326_r813"
finished
localListDone:  false  deliveryDone:  true
localListDone:  true  deliveryDone:  true
Nothing to do
Received:  0 Removed:  0 In total:  0  Wanted:  -1
finished
...
Received:  0 Removed:  0 In total:  0  Wanted:  -1
finished
log_imapresource: Detected inconsistency in local cache, we're missing some messages. Server:  25098  Local:  25004
log_imapresource: Refetching complete mailbox.
25098
Received:  4 In total:  4  Wanted:  25098

... and starts over, again and again, collecting tons of email headers in a steady 15mbps suck.

Watching my bandwidth, it generates a good 14mbps or so of traffic, and this has been going on for a week or so, so amazed someone hasn't shut me down yet.

Thunderbird handles this directory just fine, not sure why kmail has this issue, or obscurely related to some other component I'm not finding.

I'd even moved the items at a webmail level into another directory, and the problem persisted. I suspect the imap server (godaddy, go figure) really is doing something bad like not indexing them properly, or missing indices perhaps, but akonadi:imap is misbehaving epically like a thrashing child hogging a good clip of bandwidth someone is paying for (yay for unlimited bandwidth on cable still here).

I'm going to largely purge that directory, but wanted to see if I could offer anything to help fix this before doing so, but mostly it seems behavioral with akonadi imap collector not knowing when to stop after x failed attempts at the same intensive collection routine.

This also seems to cause email not to be actually commited, as I seem to not always get all mail, and not always send all mail.  It's very spotty, but I'll notice usually mail will stop and start collecting at odd intervals, presumably as a result of this folder constantly refreshing as a priority.

Reproducible: Always

Steps to Reproduce:
1. Create an imap account with bad indices in its imap folder email counts (pulls 25k emails, server reports 26k).
2. Start Akonadi from command line with akonadictl, watching the imap collection on the errant folder as it pulls headers, finds mismatch, tries again.
3. Watch Akonadi incessantly try to get the proper count in futility, using all of your bandwidth constantly.

Actual Results:  
Akonadi never completes polling the folder, just trying over and over, using a very large amount of bandwidth constantly and perpetually until akonadi is force shutdown.

Expected Results:  
* Recover from a bad index automatically (if possible)
* Offer to correct bad index on server (if possible)
* Exit and give error condition of unstable directory structure, server problem
* Simply ignore the index being bad, grab what it can grab, and poll emails normally around the bad index (seems to be thunderbird behaviour)

I've left this to be somewhat broken, but the fact that kde5 is a bit unstable with multi-monitor support still means I restart often, which respawns akonadi until I notice bandwidth usage being excessive and kill it again.  I can provide better debug, but again, seems more just methodical fixes needed to be agreed upon.
Comment 1 Justin Zobel 2022-11-18 04:30:22 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 2 Bug Janitor Service 2022-12-03 05:17:16 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 3 Bug Janitor Service 2022-12-18 05:15:23 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!