Bug 343114 - gets stuck on one request that times out, kmail and akonadiconsole do not display any mail payloads anymore, stuck waiting
Summary: gets stuck on one request that times out, kmail and akonadiconsole do not dis...
Status: REOPENED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: libakonadi (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-21 12:25 UTC by Martin Steigerwald
Modified: 2019-08-05 15:24 UTC (History)
11 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 Martin Steigerwald 2015-01-21 12:25:33 UTC
In order to find out about why KMail sometimes seems to loose Akonadi I tried what Dan suggested in:

http://lists.kde.org/?l=kde-pim&m=141501040507170&w=2

Re: [Kde-pim] KMail seems to loose connection to Akonadi at times

I did it for my work setup. Where I use a huge IMAP account hosted by Exchange. Exchange seems to not reply in time on some requests or even drop connections, but I´d expect an IMAP client to recover from that condition. I recently switched the account to "download all messages for offline use" after finding out it Akonadi caches about 7 GiB of in in file_db_data anyway (see bug #338402).



Reproducible: Sometimes

Steps to Reproduce:
It just happens after a while. I started KMail as follows for the debugging Dan suggested:

ms@merkaba:~> export AKONADI_SESSION_LOGFILE=/var/tmp/akonadi.log
ms@merkaba:~> akonadictl stop
Akonadi is not running. 
ms@merkaba:~#4> ps aux | grep mysql
martin   23674  2.7  3.4 2766408 566452 ?      Sl   Jan20  19:55 /usr/sbin/mysqld --defaults-file=/home/martin/.local/share/akonadi/mysql.conf --datadir=/home/martin/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-martin.eQY0MM/mysql.socket
ms       27067  9.9  0.7 2297324 124212 ?      Sl   09:18  15:09 /usr/sbin/mysqld --defaults-file=/home/ms/.local/share/akonadi/mysql.conf --datadir=/home/ms/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-ms.g6IkT6/mysql.socket
ms       31987  0.0  0.0  12676  1684 pts/24   S+   11:49   0:00 grep mysql
ms@merkaba:~> kill 27067
ms@merkaba:~> kill 27067
ms@merkaba:~> kill 27067
ms@merkaba:~> kill 27067
ms@merkaba:~> kill 27067
ms@merkaba:~> kill 27067
kill: kill 27067 failed: kein passender Prozess gefunden
ms@merkaba:~#1> kmail

Actual Results:  
I get this on console output:




ms@merkaba:~> kmail2(31990) MessageList::Core::ModelPrivate::viewItemJobStepInternalForJobPass1Fill: Circular In-Reply-To reference loop detected in the message tree 
kmail2(31990) MessageList::Core::ModelPrivate::findMessageParent: Circular In-Reply-To reference loop detected in the message tree



ms@merkaba:~> continuing 
request for item 1669405 "902" failed: "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." 
ItemRetrieverException :  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.
posting retrieval request for item 1669405  there are  1  queues and  0  items in mine 
request for item 1669405 still pending - waiting 
processing retrieval request for item 1669405  parts: ("RFC822")  of resource: "akonadi_imap_resource_0" 


ms@merkaba:~> continuing 
request for item 1669405 "902" failed: "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." 
ItemRetrieverException :  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.
posting retrieval request for item 1668979  there are  1  queues and  0  items in mine 
request for item 1668979 still pending - waiting 
processing retrieval request for item 1668979  parts: ("RFC822")  of resource: "akonadi_imap_resource_0"


It goes on like this. KMail even displays it in the status line at the bottom of the window. In KMail I see:

- It won´t display a single mail anymore. If just displays the blue background loading contents of current folder message instead of the mail.

- Folder switching still works.

- KMail often shows "Synchronizing folder ext4-ml" with 97% and gets stuck there. Its always 97%.


Expected Results:  
Expected results:

- Akonadi IMAP resource gives up on the time out IMAP request after some time. That said, I don´t understand why it doesn´t succeed after some times, Exchange isn´t that unresponsive either. I may drop a connection, but re-requesting it should eventually give a result.

- KMail would at least locally stored mails for offline usage if it can´t get a response from the IMAP server in time.

- KMail would display other mails stored on the IMAP server, which means that Akonadi IMAP wouldn´t block further IMAP requests, just cause one of them times out. I.e. it would process some amount of requests in parallel.

I have KMail stuck here now and asked on #akonadi on freenode about which parts of the Akonadi session log would be required for further diagnosing of the issue. I certainly won´t upload it all as it contains a ton of confidential information including folder names but also *complete* mails.

At least according to

tail -f akonadi.log.32040.akonadi_imap_resource_0

There does not seem more data after:

ms@merkaba:/var/tmp> tail -f akonadi.log.32040.akonadi_imap_resource_0
S: 1472987 FETCH (UID 1472987 REV 0 REMOTEID "59" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4079 FLAGS ())
S: 1472986 FETCH (UID 1472986 REV 0 REMOTEID "58" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4389 FLAGS ())
S: 1472985 FETCH (UID 1472985 REV 0 REMOTEID "57" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4407 FLAGS ())
S: 1472984 FETCH (UID 1472984 REV 0 REMOTEID "56" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4200 FLAGS ())
S: 1472983 FETCH (UID 1472983 REV 0 REMOTEID "55" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4000 FLAGS ())
S: 1472982 FETCH (UID 1472982 REV 0 REMOTEID "54" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4025 FLAGS ())
S: 1472981 FETCH (UID 1472981 REV 0 REMOTEID "53" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4001 FLAGS ())
S: 1472980 FETCH (UID 1472980 REV 0 REMOTEID "52" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 3988 FLAGS ())
S: 1472979 FETCH (UID 1472979 REV 0 REMOTEID "51" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 3982 FLAGS ())
S: 1472978 FETCH (UID 1472978 REV 0 REMOTEID "50" MIMETYPE "message/rfc822" COLLECTIONID 356 SIZE 4734 FLAGS ())


Also Akonadiconsole is not able to retrieve any payloads anymore. Lets see what I can enable there:

Okay, in the job tracker I see "UID FETCH" some number. One running, rest is waiting.

Akonadi IMAP resource in resource tracker is waiting on FetchItem.

When I click mails in KMail I also see "UID FETCH" as watiing in job tracker.

Well to me it seems Akonadi IMAP resource is stuck.

I am using Akonadi git with MySQL optimization, and Akonadi IMAP resource from 4.14.2 debian packages.

The IMAP resource also doesn´t respond to a "Restart" or "Abort" request in Akonadiconsole.


the Akonadi IMAP resource really seems stuck and Akonadi may serve the folder switching from metadata in the MySQL database instead.

Okay, I will end this.

I will xz the logs:

ms@merkaba:/var/tmp> du -sh akonadi* | sort -rh | head -10
102M    akonadi.log.31990.KMail Kernel ETM
27M     akonadi.log.32040.akonadi_imap_resource_0
1,7M    akonadi.log.32036.akonadi_baloo_indexer
724K    akonadi.log.31990.kmail2-1339195199
168K    akonadi.log.32046.MailFilter Kernel ETM
168K    akonadi.log.32035.Archive Mail Kernel ETM
124K    akonadi.log.32046.akonadi_mailfilter_agent
56K     akonadi.log.32041.akonadi_imap_resource_1
24K     akonadi.log.32048.akonadi_newmailnotifier_agent
20K     akonadi.log.32049.KNotes Session

But as said, tell me what you need, I won´t send it all due to confidentiality issues.

tail -f "akonadi.log.31990.KMail Kernel ETM" also does not give any more results. Seems all stuck. Last in there is:

S: 1667763 FETCH (UID 1667763 REV 0 MIMETYPE "message/rfc822" COLLECTIONID 415 SIZE 4651 FLAGS (\SEEN) ANCESTORS ((415 "/basket-devel-ml") (296 "/KDE") (276 "imap://[…]") (0 "")) PLD:ENVELOPE[1] {235}
("Sat, 26 Oct 2013 22:12:18 +0200" "[Basket-devel] Non-ASCII text storage\r" (("Some name" NIL "some mail user name" "some domain")) NIL NIL ((NIL NIL "basket-devel" "lists.sourceforge.net")) NIL NIL NIL "<526C2222.1070603@gmail.com>" NIL))
S: OK FETCH completed
C: 120 FETCH 1:* COLLECTIONID 411  IGNOREERRORS ANCESTORS INF EXTERNALPAYLOAD (UID COLLECTIONID FLAGS SIZE TAGS PLD:ENVELOPE ATR:entityannotations)

Even if I click mails in KMail, nothing more comes. Actually I am in the basket folder now. So this may be the last it got.

Okay, interesting, when I switch folders in KMail I get somemore. Okay for switching folders I get more output there. But not more in "akonadi.log.32040.akonadi_imap_resource_0".

Okay, and now, after more of half an hour digging into thinks I got a kwallet requester asking for my IMAP password again. But I didn´t close the KDE session or lock the screen. And the progress bar in KMail with Synchronizing ext4-ml at 97% disappeared.

Still I keep getting these:

ms@merkaba:~> continuing 
request for item 2039976 "6" failed: "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." 
ItemRetrieverException :  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.
processing retrieval request for item 1363436  parts: ("RFC822")  of resource: "akonadi_imap_resource_0" 
continuing 
request for item 1363436 still pending - waiting 
continuing 
request for item 2520302 still pending - waiting 
posting retrieval request for item 2039977  there are  1  queues and  1  items in mine 
request for item 2039977 still pending - waiting 

ms@merkaba:~>  list is empty 
continuing 
request for item 1363436 "9" failed: "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." 
processing retrieval request for item 2520302  parts: ("RFC822")  of resource: "akonadi_imap_resource_0" 
ItemRetrieverException :  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.
continuing 
request for item 2520302 still pending - waiting 
continuing 
request for item 2039977 still pending - waiting 
posting retrieval request for item 1363439  there are  1  queues and  1  items in mine 
request for item 1363439 still pending - waiting 
kmail2(31990) MessageList::Core::ModelPrivate::findMessageParent: Circular reference loop detected in the message tree 
processing retrieval request for item 2039977  parts: ("RFC822")  of resource: "akonadi_imap_resource_0" 
continuing 
continuing 
request for item 2520302 "49727" failed: "Unable to retrieve item from resource: <html>Der Auftrag wurde abgebrochen</html>" 
continuing 
request for item 1363439 still pending - waiting 
request for item 2039977 still pending - waiting 
ItemRetrieverException :  Unable to retrieve item from resource: <html>Der Auftrag wurde abgebrochen</html>
posting retrieval request for item 2520302  there are  1  queues and  1  items in mine 
request for item 2520302 still pending - waiting 
kmail2(31990) MessageList::Core::ModelPrivate::viewItemJobStepInternalForJobPass1Fill: Circular In-Reply-To reference loop detected in the message tree 
kmail2(31990) MessageList::Core::ModelPrivate::findMessageParent: Circular In-Reply-To reference loop detected in the message tree
Comment 1 Martin Steigerwald 2015-01-21 12:32:06 UTC
I put it on severity major, as basically this makes it impossible to use KMail for reading mail with Exchange IMAP and probably in other situations unless restarting either KMail and/or Akonadi several times a day. I think I need to restart Akonadi now, as it seems to me that Akonadi IMAP resource is stuck.

I remember some other bug like this, but I didn´t find it with search terms "Exchange" or "unable to retrieve". Anyway, this at least contains quite some debug information.

Now trying to restart kmail:

And it helps. Now I can access mail again. Interesting.

I bet what might work as a temporary work-around would be to kick IMAP resource somehow. A restart in Akonadiconsole doesn´t work.

Now Akonadiconsole GUI is frozen completely after KMail restart. At, there goes. Too much debugging output in there. Freezes occassionally.

So it seems to me that the one request to display a mail in KMail while Ext4-ml folder synchronizing stops at 97% seems to block IMAP resource completely, until I stop and restart KMail again.
Comment 2 Martin Steigerwald 2015-03-12 11:50:07 UTC
I want to add that I see the "Unable to retrieve item from resource: Did not receive a reply." with my private setup which primarily filters my main and my other POP3 accounts in a huge local maildir resource from time to time as well.

Sometimes it helps to really quit KMail, make sure the process is really gone, and then restart. But I also had it that I have to restart Akonadi as well. I think I may look into this as well the next time it happens. That setup also has an 30-day limited Dovecot based IMAP account, so it may be a similar issue.

If a KMail restart would help in all cases, I´d suspect that KMail and Akonadi loose connection to one another sometimes. But now I had it several times that I also had to restart Akonadi itself as just restarting kmail without making sure the process is really gone in between didn´t help to make KMail respond to user input again.
Comment 3 Martin Steigerwald 2015-03-21 22:24:30 UTC
With Akonadi 1.13 branch, kdepimlibs, kdepim-runtime and kdepim as of 12th of March this issue does not seem to happen anymore, neither for my private POP3 + IMAP setup, nor for the Exchange IMAP setup for work. There may still be some delays with blue waiting display in KMail, but usually after some seconds it gets back to work.

I bet I can only set this to resolved/worksforme after setting it from unconfirmed to confirmed, so I try this.
Comment 4 Martin Steigerwald 2015-03-21 22:25:53 UTC
Nope, that doesn´t work, I cannot set it to resolved/worksforme, now I only have the option to set it back to unconfirmed. Ey, this is my bug.

Anyway, feel free to set to resolved/worksforme.
Comment 5 Martin Steigerwald 2015-05-04 12:20:40 UTC
I reopen this.

I have this again, for IMAP now, but rarely, and daily or even several times a day for POP3 to maildir resource. KMail and Akonadi just do not seem to talk to each other anymore, both idling, and KMail does not display any payloads or new mails in inbox mail list anymore until restarted.
Comment 6 David C. Bryant 2019-08-04 21:52:02 UTC
I did a clean install of openSuSE LEAP 15.0 about a month ago. This problem started soon thereafter. A bunch of spurious files are generated,and a bunch of mysql records that tie to remoteid=NULL are created. Then the whole thing locks up ... I see a "Please wait, retrieving message" screen in KMail that never goes away.

So far, the only way I can fix it is by rebooting, or by stopping and restarting the Plasma desktop (log out, then log back in). I've tried poking around with akonadictl from a console window, but have had no luck with that approach so far. I haven't tried "killall" and "kstart" from Krunner ... I'll try that the next time this happens, and add another comment at that time.
Comment 7 Martin Steigerwald 2019-08-05 07:07:23 UTC
Dear David, thanks for adding your update to the bug report. However, if you change the version please also really set a new version, instead of setting 'unspecified'. Do 'akonadictl --version' and specify the version you see in the bug report. If the version is not in the selection, please select the closest one and put the output of the command in a comment. Please do not expect upstream developers to know or dig out what version OpenSUSE LEAP 15.0 would contain.

Also preferably use OpenSUSE LEAP 15.1 to test with the newest version available.

Additionally for me "akonadictl stop" and "akonadictl start" worked in order to bring Akonadi back into a working state. So your issue may even be something completely different. It would be beneficial to at least gather some console output to see whether you are really having the same issue.

Especially whether you see the same:

request for item 1669405 "902" failed: "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." 

kind of messages. For that to see start kmail from a terminal.
Comment 8 David C. Bryant 2019-08-05 14:06:43 UTC
Well, my version of PIM (Akonadi et al.) is 5.7.3, and that's not on the list, so that's why I said "unspecified" ... there wasn't any way to say "other" and fill in the blank, that I could see.

My issue isn't at startup time. KMail just freezes up from time to time, apparently at random. I download all my e-mail using POP, so my set of folders is pretty big and elaborate -- about 20,000 files and 1.6GB, according to Dolphin. I've been using KMail since 2003.

I don't have enough room to run more than one version of Linux on my current box. And it takes a lot of work to install a new release.So thanks for the suggestion about 15.1, but I'm not likely to undertake that endeavor right away.

I have already tried stopping akonadi and restarting it. I don't think there are any issues with KMail when it first starts -- just a minute -- I'll go check. I do get a couple of warning messages.

-------------------------------------------------------------------------
[0805/084258.513261:WARNING:stack_trace_posix.cc(648)] Failed to open file: /home/david/#2753352 (deleted)
  Error: No such file or directory
1 : "Uncaught ReferenceError: qt is not defined"
1 : "Uncaught ReferenceError: qt is not defined"
--------------------------------------------------------------------------

The first one makes some sense to me ... after KMail froze up the last time, there were about 100 spurious objects ("no RID") and 75 spurious files ("unreferenced external files") when I ran "akonadictl fsck". Akonadi wouldn't get rid of all of them on its own, so I resorted to brute force (I got this trick from somebody named Karl (Langenfeldt?) in the openSuSE forums.)

~: find .local/share/akonadi/file_db_data/ -type f|xargs rm

As I recall, that erased about 20 unreferenced external files. So the one file KMail is squawking about may be one of those.

The other messages, about "qt", make no sense to me, at all. Thanks!

PS I just opened this bug report because I haven't had this problem with KMail until very recently. It's not a real big deal as far as I'm concerned. It's just an annoyance -- when it stops working, I have to shut KMail down, than log out of Plasma and log back in again. That takes maybe 2 or 3 minutes. A nuisance, but not the end of the world.  :)

(In reply to Martin Steigerwald from comment #7)
> Dear David, thanks for adding your update to the bug report. However, if you
> change the version please also really set a new version, instead of setting
> 'unspecified'. Do 'akonadictl --version' and specify the version you see in
> the bug report. If the version is not in the selection, please select the
> closest one and put the output of the command in a comment. Please do not
> expect upstream developers to know or dig out what version OpenSUSE LEAP
> 15.0 would contain.
> 
> Also preferably use OpenSUSE LEAP 15.1 to test with the newest version
> available.
> 
> Additionally for me "akonadictl stop" and "akonadictl start" worked in order
> to bring Akonadi back into a working state. So your issue may even be
> something completely different. It would be beneficial to at least gather
> some console output to see whether you are really having the same issue.
> 
> Especially whether you see the same:
> 
> request for item 1669405 "902" failed: "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." 
> 
> kind of messages. For that to see start kmail from a terminal.
Comment 9 Martin Steigerwald 2019-08-05 15:24:14 UTC
David, Akonadi 5.7.3 is quite old, from KDEPIM 18.04 from April 2018 if I got this right.

I am still not clear whether it is really the same bug, as I for me the original issue did not happen anymore since quite a while and I just forgot to close the bug report.

Please consider to test with a newer KDEPIM/Akonadi version. You may use KDE Neon ISO images in a virtual machine for that. In any case I suggest you report your issue as a new bug, cause this bug IMHO is quite old, got quite convoluted and difficult for developers to make sense of. In that case I'd close this bug. Also if just replying to the last comment it is not necessary to quote and top-post. Short and precise is key for developers to act on bugs, which I did not adhere to back then either.