Bug 318281

Summary: KMail doesn´t respond: ItemRetrieverException : Unable to retrieve item from resource
Product: [Frameworks and Libraries] Akonadi Reporter: Martin Steigerwald <Martin>
Component: serverAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: dvratil, luisfe
Priority: NOR    
Version: 4.10   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: xsession-errors of the last occurence of this slow responding in KMail after triggering POP3 retrieval

Description Martin Steigerwald 2013-04-13 09:48:14 UTC
Especially soon after triggering a mail retrieval from my POP3 accounts I have it that KMail is unresponsive.

Reproducible: Sometimes

Steps to Reproduce:
1. Have an POP3 account with LKML and some other high volume lists.
2. Let it pile up mails over night.
3. Retrieve messages the next morning
Actual Results:  
Sometimes KMail / Akonadi server doesn´t respond in a timely manner. Examples:

1) I click on a message in the message list. In the message reader pane KMail shows that it retrieves the message for minutes.

2) I click on a folder, like inbox, with about some thousand mails and it just shows the spinning wheel before the folder name for minutes

Expected Results:  
On an ThinkPad T520 with Intel Sandybridge i5-2520M 2,5GHz, that the ThinkPad lets overtact itself to about 3/3.2 GHz for extended period of times hyperthreaded dual core CPU, 8 GB of RAM, and an 300 GB SATA 300 Intel SSD 320 I expect reactions to user input in KMail to be about instant at all times, except for maybe really large folders, where it may take some seconds.

During this behaviour I get stuff like the following in ~/.xsession-errors:


ItemRetrieverException :  Unable to retrieve item from resource: Did not receive a reply. Possible causes include: the remote application did not s
end a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
kmail2(13538)/libakonadi Akonadi::EntityTreeModelPrivate::fetchJobDone: Job error:  "Unable to fetch item from backend (collection 35) : 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 securit
y policy blocked the reply, the reply timeout expired, or the network connection was broken." for collection: 35 


ItemRetrieverException :  Unable to retrieve item from resource: Did not receive a reply. Possible causes include: the remote application did not s
end a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
kmail2(13538)/libakonadi Akonadi::EntityTreeModelPrivate::fetchJobDone: Job error:  "Unable to fetch item from backend (collection 35) : 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 securit
y policy blocked the reply, the reply timeout expired, or the network connection was broken." for collection: 35 


This morning I also have:

kmail2(13538)/libakonadi Akonadi::EntityTreeModelPrivate::monitoredItemChanged: Got a stale notification for an item which was already removed. 447
047 "1365845303.R253.merkaba" 

After some minutes now things have settled down and I am able to see the new mail again.

During this occurence often the system is not fully under load. It was using "only" about 2 of the 4 logical cores of the CPU. And it wasn´t using all of the availble SSD bandwidth / IOPS. Thus I suspect some issue with communiction between different components of Akonadi / KMail / Nepomuk.

While this doesn´t make the software completely unusable, I think its still more than Normal in severity. Well, you choose.

This may be related to:

[Bug 318234] New: KMail sometimes does not update source folder view on move or mark operations unless restarted

I use the following setup:

1) I had all mails in ~/Mail

2) I moved all recent mails from ~/Mail to a newly created BTRFS subvolume ~/.Mail so that I can snapshot it. I moved all the archived mails to ~/.Mail-Archiv, as these are mbox folders.

3) Then I let the migrator run so that it puts my account information into kmail2rc.

4) For each POP3 account I use I created an extra maildir agent pointing it at the maildir and then selecting "Synchronize All" in Akonadiconsole. Thus for my main account Lichtvoll I gave it ~/.Mail/Lichtvoll as maildir directory for example:

drwx------ 1 martin martin        18 Apr 11 08:33 Lichtvoll
drwx------ 1 martin martin      4106 Apr 11 17:28 .Lichtvoll.directory
-rw------- 1 martin martin   4312743 Apr 11 08:33 .Lichtvoll.index
-rw------- 1 martin martin     33909 Apr 11 08:33 .Lichtvoll.index.ids

For local mails I created:

drwx------ 1 martin martin        18 Jan  2 11:36 Lokal
drwxr-xr-x 1 martin martin       528 Apr 11 09:50 .Lokal.directory

and copied all the local mail folders into that.

5) I imported my filter rules back to this new setup, set inboxes for mail download to the right top level maildir directories and so on.


Size of setup:

martin@merkaba:~> find ~/.Mail | wc -l
431234
martin@merkaba:~> du -sh ~/.Mail
6,5G    /home/martin/.Mail


The KDEPIM-2 packages are from Debian developers, but they are not publically available in official Debian repositories. I test them for for them.

martin@merkaba:~> apt-show-versions | egrep "(kdepim|korganizer|kmail|knode|kaddressbook|zanshin|akonadi|nepomuk|strigi|virtuoso|soprano|libqt)"   akonadi-backend-mysql/experimental uptodate 1.9.1-2
akonadi-backend-postgresql/experimental uptodate 1.9.1-2
akonadi-backend-sqlite/experimental uptodate 1.9.1-2
akonadi-server/experimental uptodate 1.9.1-2
akonadiconsole 4:4.10.2-0r4 newer than version in archive
kaddressbook 4:4.10.2-0r4 newer than version in archive
kaddressbook-mobile 4:4.10.2-0r4 installed: No available version in archive
kdegraphics-strigi-analyzer/sid uptodate 4:4.8.4-1
kdepim 4:4.10.2-0r4 newer than version in archive
kdepim-dbg 4:4.10.2-0r4 newer than version in archive
kdepim-kresources 4:4.10.2-0r4 newer than version in archive
kdepim-mobileui-data 4:4.10.2-0r4 installed: No available version in archive
kdepim-runtime/experimental uptodate 4:4.10.2-1
kdepim-strigi-plugins 4:4.10.2-0r4 newer than version in archive
kdepimlibs-dbg/experimental uptodate 4:4.10.2-1
kdepimlibs-kio-plugins/experimental uptodate 4:4.10.2-1
kdesdk-strigi-plugins/sid uptodate 4:4.8.4+dfsg-1
kmail 4:4.10.2-0r4 newer than version in archive
kmail-mobile 4:4.10.2-0r4 installed: No available version in archive
knode 4:4.10.2-0r4 newer than version in archive
korganizer 4:4.10.2-0r4 newer than version in archive
korganizer-mobile 4:4.10.2-0r4 installed: No available version in archive
libakonadi-calendar4/experimental uptodate 4:4.10.2-1
libakonadi-contact4/experimental uptodate 4:4.10.2-1
libakonadi-kabc4/experimental uptodate 4:4.10.2-1
libakonadi-kcal4/experimental uptodate 4:4.10.2-1
libakonadi-kde4/experimental uptodate 4:4.10.2-1
libakonadi-kmime4/experimental uptodate 4:4.10.2-1
libakonadi-notes4/experimental uptodate 4:4.10.2-1
libakonadi-socialutils4/experimental uptodate 4:4.10.2-1
libakonadiprotocolinternals1/experimental uptodate 1.9.1-2
libkdepim4 4:4.10.2-0r4 newer than version in archive
libkdepimdbusinterfaces4 4:4.10.2-0r4 installed: No available version in archive
libkdepimmobileui4 4:4.10.2-0r4 installed: No available version in archive
libnepomuk4/experimental uptodate 4:4.10.2-2
libnepomukcore4/experimental uptodate 4:4.10.2-1
libnepomukquery4a/experimental uptodate 4:4.10.2-2
libnepomukutils4/experimental uptodate 4:4.10.2-2
libnepomukwidgets4/experimental uptodate 4:4.10.2-1
libqt4-dbg/sid uptodate 4:4.8.2+dfsg-11
libqt4-dbus/sid uptodate 4:4.8.2+dfsg-11
libqt4-declarative/sid uptodate 4:4.8.2+dfsg-11
libqt4-designer/sid uptodate 4:4.8.2+dfsg-11
libqt4-dev/sid uptodate 4:4.8.2+dfsg-11
libqt4-dev-bin/sid uptodate 4:4.8.2+dfsg-11
libqt4-help/sid uptodate 4:4.8.2+dfsg-11
libqt4-network/sid uptodate 4:4.8.2+dfsg-11
libqt4-opengl/sid uptodate 4:4.8.2+dfsg-11
libqt4-qt3support/sid uptodate 4:4.8.2+dfsg-11
libqt4-script/sid uptodate 4:4.8.2+dfsg-11
libqt4-scripttools/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-mysql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-psql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-sqlite/sid uptodate 4:4.8.2+dfsg-11
libqt4-svg/sid uptodate 4:4.8.2+dfsg-11
libqt4-test/sid uptodate 4:4.8.2+dfsg-11
libqt4-xml/sid uptodate 4:4.8.2+dfsg-11
libqt4-xmlpatterns/sid uptodate 4:4.8.2+dfsg-11
libqtassistantclient4/sid uptodate 4.6.3-4
libqtcore4/sid uptodate 4:4.8.2+dfsg-11
libqtdbus4/sid uptodate 4:4.8.2+dfsg-11
libqtglib-2.0-0/sid uptodate 0.10.2-2
libqtgstreamer-0.10-0/sid uptodate 0.10.2-2
libqtgstreamerui-0.10-0/sid uptodate 0.10.2-2
libqtgui4/sid uptodate 4:4.8.2+dfsg-11
libqtlocation1/sid uptodate 1.2.0-3
libqtruby4shared2/sid uptodate 4:4.8.4-1
libqtscript4-core/sid uptodate 0.2.0-1
libqtscript4-gui/sid uptodate 0.2.0-1
libqtscript4-network/sid uptodate 0.2.0-1
libqtscript4-sql/sid uptodate 0.2.0-1
libqtscript4-uitools/sid uptodate 0.2.0-1
libqtscript4-xml/sid uptodate 0.2.0-1
libqtwebkit-dev/sid uptodate 2.2.1-5
libqtwebkit4/sid uptodate 2.2.1-5
libqtwebkit4-dbg/sid uptodate 2.2.1-5
libqtxdg0/sid uptodate 0.4.1-2
libsmokeakonadi3/sid uptodate 4:4.8.4-1
libsmokenepomuk3/sid uptodate 4:4.8.4-1
libsmokesoprano3/sid uptodate 4:4.8.4-1
libsoprano-dev/experimental uptodate 2.9.0+dfsg1-1
libsoprano4/experimental uptodate 2.9.0+dfsg1-1
nepomuk-core-data/experimental uptodate 4:4.10.2-1
nepomuk-core-runtime/experimental uptodate 4:4.10.2-1
ruby-akonadi/sid uptodate 4:4.8.4-1
ruby-soprano/sid uptodate 4:4.8.4-1
soprano-daemon/experimental uptodate 2.9.0+dfsg1-1
virtuoso-minimal/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
virtuoso-opensource-6.1-bin/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
virtuoso-opensource-6.1-common/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
zanshin/sid uptodate 0.2.1-1+b1
Comment 1 Martin Steigerwald 2013-04-13 09:56:46 UTC
Created attachment 78858 [details]
xsession-errors of the last occurence of this slow responding in KMail after triggering POP3 retrieval

Usernames of POP3 replaced by nothing.
Comment 2 Martin Steigerwald 2013-04-13 10:19:07 UTC
Secondary issues seen in ~/.xsession-errors:

Bug 318283 - KMail/libakonadi: Got a stale notification for an item which was already removed

Bug 318284 - Messages like 'Payload file "[…].local/share/akonadi/file_db_data/797210_r0" is missing, trying to recover.'
Comment 3 Martin Steigerwald 2013-04-13 10:49:16 UTC
According to akonadiconsole in those circumstances often my biggest maildir resource lichtvoll stalls synchronization at some random folder. It then sits there for minutes to come, even if its just a smaller folder it got stuck at.

Thus I suspect a communication issue between the different 
components involved.

Also adding versions of dbus packages to the mix:

martin@merkaba:~> apt-show-versions | grep "dbus"
dbus/sid uptodate 1.6.8-1
dbus-x11/sid uptodate 1.6.8-1
libdbus-1-3/sid uptodate 1.6.8-1
libdbus-1-dev/sid uptodate 1.6.8-1
libdbus-c++-1-0/sid uptodate 0.9.0-6
libdbus-glib-1-2/sid uptodate 0.100.2-1
libdbusmenu-glib4/sid uptodate 0.6.2-1
libdbusmenu-qt2/sid uptodate 0.9.0-1
libkdepimdbusinterfaces4 4:4.10.2-0r4 installed: No available version in archive
libnet-dbus-perl/sid uptodate 1.0.0-2
libqt4-dbus/sid uptodate 4:4.8.2+dfsg-11
libqtdbus4/sid uptodate 4:4.8.2+dfsg-11
libsmokeqtdbus4-3/sid uptodate 4:4.8.4-1
python-dbus/sid uptodate 1.1.1-1
python-dbus-dev/sid uptodate 1.1.1-1
python-qt4-dbus/sid uptodate 4.9.3-4
qdbus/sid uptodate 4:4.8.2+dfsg-11


Maybe these deadlocks with some MySQL queries are also related:

martin@merkaba:~/KDE/Bugs/318281 KMail doesn´t respond: ItemRetrieverException : Unable to retrieve item from resource> xzgrep -i "dead" xsession-errors.txt.xz
Error during executing query "UPDATE PimItemTable SET atime = :0 WHERE ( ( PimItemTable.id = :1 ) )" :  "Deadlock found when trying to get lock; try restarting transaction QMYSQL3: Unable to execute statement"
[… some PlaneShift game client related messages …]
Error during executing query "UPDATE PimItemTable SET atime = :0 WHERE ( ( PimItemTable.id = :1 ) )" :  "Deadlock found when trying to get lock; try restarting transaction QMYSQL3: Unable to execute statement"

MySQL has been at 100% during that POP 3 download but it often uses more than that. Dunno whether there has been something going on single-threadedly. I have mytop and mysql client installed and can try to have a closer look at whats going on.

One of those is also in the shortened xsession-errors-edited.txt I attached. I am hesitant to attach the whole xsession-errors.txt cause Akonadi Nepomuk Feeder or probably some other component as well puts lots of private informations in it, included complete mail text which just don´t have anything to do in this file.

Anyway version of MySQL packages involved:

martin@merkaba:~> apt-show-versions | grep mysql
akonadi-backend-mysql/experimental uptodate 1.9.1-2
kexi-mysql-driver/sid uptodate 1:2.4.4-3
libdbd-mysql-perl/sid uptodate 4.021-1+b1
libmysqlclient-dev/sid uptodate 5.5.30+dfsg-1
libmysqlclient18/sid uptodate 5.5.30+dfsg-1
libqt4-sql-mysql/sid uptodate 4:4.8.2+dfsg-11
mysql-client/sid uptodate 5.5.30+dfsg-1
mysql-client-5.5/sid uptodate 5.5.30+dfsg-1
mysql-common/sid uptodate 5.5.30+dfsg-1
mysql-server-core-5.5/sid uptodate 5.5.30+dfsg-1
python-mysqldb/sid uptodate 1.2.3-2
Comment 4 luisfe 2013-05-25 11:05:06 UTC
I can confirm this behavior with kde master compiled over debian stable.
Comment 5 Daniel Vrátil 2013-12-06 17:45:13 UTC
Does this still happen to you? If you can still reproduce the database deadlock, when it happens again, please do the following:

Open Akonadi Console and in DB Console tab, run "SHOW ENGINE INNODB STATUS". This should reveal what queries are deadlocking and we can optimize them to avoid this happening in future.
Comment 6 Martin Steigerwald 2014-03-07 13:24:38 UTC
Dan, I don´t seem to see this anymore with KMail 4.12.2 and Akonadi 1.11.0 – Akonadi still isn´t exactly very responsive while doing stuff in the background (see bug #331848), but that ItemRetrieverException does not seem to appear anymore:

martin@merkaba:~> ls -lh .xsession-errors 
-rw------- 1 martin martin 1,5M Mär  7 14:19 .xsession-errors
martin@merkaba:~> grep -i "Did not receive a reply" .xsession-errors
martin@merkaba:~#1> grep -i "ItemRetrieverException" .xsession-errors 

Thus closing. Luisfe, if you still see it, please reopen. Thanks, Martn