Bug 283037 - Unable to connect to akonadi after laptop resume
Summary: Unable to connect to akonadi after laptop resume
Status: RESOLVED UNMAINTAINED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 1.6.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 283239 287844 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-29 15:14 UTC by Scott Kitterman
Modified: 2017-01-07 22:00 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
'akonadictl start' output (6.14 KB, text/plain)
2011-10-04 09:52 UTC, René Krell
Details
mysql.conf from .local/share/akonadi (2.11 KB, text/plain)
2011-11-29 02:39 UTC, p92
Details
Message display hangup (708.15 KB, image/png)
2011-12-12 03:53 UTC, Szymon Stefanek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Kitterman 2011-09-29 15:14:50 UTC
Version:           1.6.0 (using KDE 4.7.1) 
OS:                Linux

I few times since upgrading this laptop to KDE 4.7 (and moving from Kmail to Kmail2) I've been unable to read email via imap.  When I click on a message it says "Retrieving folder contents, please wait" indefinitely.

I tried exiting kmail and restarting it, but still had the same problem.  After stopping and starting akonadi using the Akonadi Server Configuration KCM, then it was able to read mail (without restarting kmail2 again).

Note: Akonadi version is actually 1.6.1, but I didn't see that option under application version.

Reproducible: Sometimes

Steps to Reproduce:
Suspend laptop, resume laptop, check mail provided via an imap resource.

Actual Results:  
"Retrieving folder contents, please wait"

Expected Results:  
Mail retrieved so I can read it.
Comment 1 René Krell 2011-10-03 11:14:53 UTC
I get a similar problem, but generally on all kinds of Akonadi resources immediately after KMail starts.

KMail version 4.7.1.

Akonadi uses an external, but local MYSQL server.
Comment 2 Christophe Marin 2011-10-03 12:18:03 UTC
*** Bug 283239 has been marked as a duplicate of this bug. ***
Comment 3 Christophe Marin 2011-10-03 12:19:24 UTC
> Akonadi uses an external, but local MYSQL server.

Did you configure it ? specially the wait_timeout parameter ?
Comment 4 René Krell 2011-10-03 12:24:41 UTC
No, I left the default settings in /etc/my.conf, connecting to localhost as "root" (regardless whether using TCP/IP and UNIX socket):

# The following options will be passed to all MySQL clients
[client]
#password	= your_password
port		= 3306
socket		= /var/run/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port		= 3306
socket		= /var/run/mysql/mysql.sock
# Change following line if you want to store your database elsewhere
datadir	= /var/lib/mysql
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# binary logging format - mixed recommended
binlog_format=mixed

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id	= 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

# The safe_mysqld script
[safe_mysqld]
log-error	= /var/log/mysql/mysqld.log
socket		= /var/run/mysql/mysql.sock

[mysqldump]
socket		= /var/run/mysql/mysql.sock
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log        = /var/log/mysqld_multi.log
# user       = multi_admin
# password   = secret

# If you want to use mysqld_multi uncomment 1 or more mysqld sections
# below or add your own ones.

# WARNING
# --------
# If you uncomment mysqld1 than make absolutely sure, that database mysql,
# configured above, is not started.  This may result in corrupted data!
# [mysqld1]
# port       = 3306
# datadir    = /var/lib/mysql
# pid-file   = /var/lib/mysql/mysqld.pid
# socket     = /var/lib/mysql/mysql.sock
# user       = mysql

# [mysqld2]
# port       = 3307
# datadir    = /var/lib/mysql-databases/mysqld2
# pid-file   = /var/lib/mysql-databases/mysqld2/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld2/mysql.sock
# user       = mysql

# [mysqld3]
# port       = 3308
# datadir    = /var/lib/mysql-databases/mysqld3
# pid-file   = /var/lib/mysql-databases/mysqld3/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld3/mysql.sock
# user       = mysql

# [mysqld6]
# port       = 3309
# datadir    = /var/lib/mysql-databases/mysqld6
# pid-file   = /var/lib/mysql-databases/mysqld6/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld6/mysql.sock
# user       = mysql
Comment 5 René Krell 2011-10-04 07:52:13 UTC
Interesting: After restart I always get 6 - 7 messages shown, but after clicking through them it hangs again with "Retrieving folder contents, please wait" and doesn't return.
Comment 6 René Krell 2011-10-04 07:55:49 UTC
Using MYSQL Server 5.5.16 from the openSUSE server:database repository, QtSQL client linked with MYSQL client r16 instead of r18. Maybe a bad combination, because OpenSUSE 11.4 still ships with 5.1.53?
Comment 7 Christophe Marin 2011-10-04 08:14:38 UTC
correct,

ldd /usr/lib64/qt4/plugins/sqldrivers/libqsqlmysql.so |grep mysql

must return something valid.


and when using an external server, it has to be configured first (which akonadi cannot do with this configuration)

when letting Akonadi start its own mysql instance, wait_timeout=31536000 is used
Comment 8 René Krell 2011-10-04 09:24:49 UTC
I returned to the default MYSQL server in openSUSE 11.4 and, for being sure, uninstalled all r18 client libraries. Running ldd /usr/lib64/qt4/plugins/sqldrivers/libqsqlmysql.so |grep mysql returns:
libmysqlclient_r.so.16 => /usr/lib64/libmysqlclient_r.so.16 (0x00007fedb1395000)

What I've done:
- Quit KMail
- Stop Akonadi server
- Stop MySQLd
- Reinstalled MySQL 5.1 as described above
- Added to my.cnf in section [mysqld] a line
  wait_timeout = 31536000
- Start MySQLd
- Start Akonadi server
- Start KMail

Unfortunately It is still hanging.
Comment 9 Christophe Marin 2011-10-04 09:43:48 UTC
Please attach:
* the 'akonadictl start' output,

and paste: 
* the error log content from ~/.local/share/akonadi/db_data
Comment 10 René Krell 2011-10-04 09:52:13 UTC
Created attachment 64194 [details]
'akonadictl start' output
Comment 11 René Krell 2011-10-04 09:55:02 UTC
See attachment and current error log doesn't exist in ~/.local/share/akonadi/db_data.
Comment 12 René Krell 2011-10-04 10:06:48 UTC
Currently KMail doesn't hang, I've aöready opened dozens of messages from different Akonadi resources. Strange, but the term: "Reproducible: Sometimes" seems to fit also for me.
Comment 13 René Krell 2011-10-04 10:09:42 UTC
... now it is hanging again, but no new error log has appeared.
Comment 14 Scott Kitterman 2011-10-04 14:23:25 UTC
To be clear (as the original reporter): I'm using the internal mysql database.  Sometimes it works, sometimes it doesn't.
Comment 15 René Krell 2011-10-12 08:03:21 UTC
Got KMail working after removing all Akonadi user data and recreating the database (just don't know for how long):

$> akonadictl stop
$> rm -rf $HOME/.local/share/akonadi/
$> mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.5.16-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop database akonadi;
Query OK, 11 rows affected (0.47 sec)

mysql> create database akonadi;
Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye
$> cat $HOME/.config/akonadi/akonadiserverrc
[%General]
Driver=QMYSQL

[QMYSQL]
Name=akonadi
Host=localhost
StartServer=false
Options="UNIX_SOCKET=/var/run/mysql/mysql.sock"
ServerPath=/usr/bin/mysqld
User=root
Password=do_not_tell

[Debug]
Tracer=null
$> akonadictl start

After those actions KMail shows the selected messages. Will tell you, if it will go wrong again.
Comment 16 René Krell 2011-10-12 08:40:46 UTC
KMail hung again with "Retrieving Folder Contents...".
For me it looks like KMail deadlocks when viewing messages while resyncing resources, even if clicking on messages from other resources. In my case it was a resync of a Local KMail folders resource.
After resyncing was done KMail displays all messages again, but very slowly, it takes up to a few seconds to view messages.
I still don't overlook how to best reproduce it, maybe you got a hint for me.
Comment 17 René Krell 2011-10-12 09:00:38 UTC
Furthermore there isn't any mail marked as read and even "Mark all as read" over some folder doesn't mark messages read, regardless in which resource (IMAP, local folders, local KMail folders).
Comment 18 menschmeier 2011-10-14 19:36:19 UTC
I do have the same problem. 

With folders or mails that I have imported the message "Retrieving Folder Contents Please wait . . ." is displayed endlessly. I never can read the mail content.

With mails I downloaded from a pop3 server, sometimes I can read the content.
Comment 19 felix_mauch 2011-10-15 07:49:30 UTC
Same here. Problem occurs most often after coming out of suspend to RAM.
BTW: Why is this bug still unconfirmed, while it is confirmed for the ubuntu package? (See bug https://bugs.launchpad.net/ubuntu/+source/akonadi/+bug/862483)
I'm having the same issues on my Archlinux machine.
Comment 20 Kusi 2011-11-24 20:31:42 UTC
same here. KDE 4.7.3. Clicking on a folder ends up in "retrieving folder contents". akonadictrl stop and then restart it again solved it. let me know if you need more information.
Comment 21 p92 2011-11-29 02:37:23 UTC
I have exactly the same problem. I am unable to read ANY of my emails !
stop/start akonadi, kmail, linux reboot does not improve anything.

This is a VERY SERIOUS PROBLEM rendering kmail unusable.

Error messages in mysql.err are :

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
Comment 22 p92 2011-11-29 02:39:42 UTC
Created attachment 66167 [details]
mysql.conf from .local/share/akonadi
Comment 23 Kamil Dziedzic 2011-12-01 09:11:19 UTC
There are two solutions to this problem:
1. `akonadictl restart` after each resume
2. Stop using kde

Seriously is there anything working in kde4?
Comment 24 felix_mauch 2011-12-01 09:32:27 UTC
Actually, since 4.7.3 things are working better for me. akonadictl restart is not required everytime after suspend. But still sometimes.
Comment 25 David Jarvie 2011-12-02 12:53:38 UTC
*** Bug 287844 has been marked as a duplicate of this bug. ***
Comment 26 David Jarvie 2011-12-02 12:56:14 UTC
This also applies to other Akonadi resources, not just those used by kmail. See
bug 287844.
Comment 27 Szymon Stefanek 2011-12-12 03:53:27 UTC
Created attachment 66647 [details]
Message display hangup

I also have this bug.

When I click on a message in a folder it isn't displayed at all.

Earlier some of the messages were displayed after a long time
(minutes) and I also had a "KMail Folders: Aborting" progress item
stuck at 0% which won't go away when the "minus" sign was clicked.
(See the attached screenshot).

After I restarted kontact+akonadi the situation got worse an
no message is displayed anymore.

It seems that akonadi is doing something in the background (no clue
what since I did nothing really special except checking mail recently).
In the output I see a lot of error similar to:

akonadi_mixedmaildir_resource_1(24826)/akonadiresource (maildir): "Cannot add email to folder xxx@yyy.zzz because there is no email content" 
akonadi_mixedmaildir_resource_1(24826)/akonadiresource (maildir): "Cannot add email to folder xxx@yyy.zzz because there is no email content"

and later:

request for item 139893 "1323434706.R514.spyro:2,S" 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 139803  there are  1  queues and  0  items in mine 
request for item 139803 still pending - waiting 
processing retrieval request for item 139803  parts: ("RFC822", "HEAD")  of resource: "akonadi_mixedmaildir_resource_1" 

In the ps output I see that all the resources seem to be running.
The nepomuk email feeder process is using 66% of the CPU and 200MB
of RAM (but nepomuk is disabled here).

pragma   24828 66.8  2.4 632788 203392 ?       Sl   04:37   8:16 /usr/bin/akonadi_nepomuk_email_feeder --identifier akonadi_nepomuk_email_feeder
Comment 28 Szymon Stefanek 2011-12-12 04:31:51 UTC
More digging into this.

When I try to browse the e-mail tree with akonadiconsole I can't access
the contents of the folders (which should belong to a mixedmail resource).
In the debugger window I see:

AkonadiConsole Browser Widget (0x103a430) 8 FETCH 1:* FULLPAYLOAD ANCESTORS INF EXTERNALPAYLOAD (UID REMOTEID REMOTEREVISION COLLECTIONID FLAGS SIZE DATETIME) 
AkonadiConsole Browser Widget (0x103a430) 8 NO Unable to fetch item from backend 

The mixedmail resource is running idle (i've attached a gdb session to it and it seems to be sitting mainly inside poll()).
Comment 29 Szymon Stefanek 2011-12-12 06:46:41 UTC
I've managed to view some of the emails by killing the mixedmail resource and (re)starting it manually in the console several times.

From this I've figured out that the mixedmail resource gets stuck on something.

Once I start it kmail shows the messages. Then I browse around the folders to display random messages: after several clicks it starts slowing down and after a few more it gets stuck totally. From that point on no more messages are viewable
(even the ones that were visible before can't be viewed).


When the bug is triggered (that is kmail displays the "Retrieving Folder Contents" message for the first time) the resource stays quiet for some seconds and then spits out a lot of messages similar to this one:

akonadi_mixedmaildir_resource_1(8900)/akonadiresource (maildir) RetrieveItemsJob::Private::fetchChangedResult: Store fetch for changed item "1323661243.R144.spyro" in collection -869 , "" did not return the expected item. error= 102 , "Given folder name is empty" 
akonadi_mixedmaildir_resource_1(8900)/akonadiresource (maildir): "Given folder name is empty" collection: Collection ID: -12556    remote ID: "" 
   name: "" 
   url: KUrl("akonadi:?collection=-12556") 
   parent: -869 "" 
   resource: "" 
   rights: QFlags(0x1|0x2|0x4|0x8|0x10|0x20) 
   contents mime type: () 
    CachePolicy:  
   inherit: true 
   interval: -1 
   timeout: -1 
   sync on demand: false 
   local parts: () 
    CollectionStatistics: 
   count: -1 
   unread count: -1 
   size: -1 
akonadi_mixedmaildir_resource_1(8900)/akonadiresource (maildir) RetrieveItemsJob::Private::fetchChangedResult: Store fetch for changed item "1323661243.R175.spyro" in collection -869 , "" did not return the expected item. error= 102 , "Given folder name is empty" 

From that point the resource is stuck. The error messages from a previous mail suggest that it doesn't answer at all to DBUS queries.

I haven't found a clear and systematic way to reproduce the issue.
Earlier I've reproduced it by opening a specific folder and clicking an email inside it. But then after a restart the same action didn't trigger the problem.

However it might be something related to timing. In particular I can trigger it very easily shortly after the akonadi server and mysql have been restarted. This is possibly because the caches are empty and take time to be filled. After I kill and restart the mixedmail resource several times, however, the bug hits less and less until I can
browse all my folders and view all my messages.

Weird.
Comment 30 Szymon Stefanek 2011-12-26 17:26:16 UTC
This bug persists also in the 4.8 packages (kubuntu).
KMail doesn't show message contents at all: it just sits there with "Retrieving folder contents". In akonadiconsole there is moderate traffic and mysql+akonadi+resources are taking an average of 200% of CPU (two cores of a quadcore system).

 2397 pragma    20   0  384m 140m 3940 S  135  1.8 549:58.47 mysqld                                                                                                                                                                          
20992 pragma    20   0  371m 112m  18m S   49  1.4 172:16.93 akonadi_mixedma                                                                                                                                                                 
20994 pragma    20   0  631m 213m  25m S   18  2.7  64:45.17 akonadi_nepomuk
Comment 31 Szymon Stefanek 2011-12-26 17:37:16 UTC
Ops.. hit submit too fast. Packages of 4.7.4 and not 4.8.
Comment 32 Denis Kurz 2016-09-24 20:35:17 UTC
This bug has only been reported for versions older than KDEPIM 4.14 (at most akonadi-1.3). Can anyone tell if this bug still present?

If noone confirms this bug for a recent version of akonadi (part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 33 Denis Kurz 2017-01-07 22:00:46 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.