Bug 278462 - Akonadi not restore connections to MySQL server
Summary: Akonadi not restore connections to MySQL server
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: 1.6.0
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 303922 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-25 09:39 UTC by Alexander Zaika
Modified: 2013-08-28 13:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.10.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Zaika 2011-07-25 09:39:31 UTC
Version:           1.6.0 (using KDE 4.6.5) 
OS:                Linux

I use external MySQL server for Akonadi, and my SQL Server configured to 50 minutes IDLE timeout (wait_timeout and interactive_timeout mysql variables). IE MySQL server closed connection if not see any activity on its during 50 minutes.
Looks like Akonadi incompatable with this MySQL settings, and can't restore connection if it closed.

Error during selection of record with id 0 from table "CollectionTable" "MySQL server has gone away QMYSQL: Unable to execute query" 
Error during executing query "SELECT PimItemTable.id, PimItemTable.remoteId, MimeTypeTable.name, ResourceTable.name, PimItemTable.rev, PimItemTable.remoteRevision, PimItemTable.size, PimItemTable.datetime, PimItemTable.collectionId FROM PimItemTable INNER JOIN MimeTypeTable ON ( PimItemTable.mimeTypeId = MimeTypeTable.id ) INNER JOIN CollectionTable ON ( PimItemTable.collectionId = CollectionTable.id ) INNER JOIN ResourceTable ON ( CollectionTable.resourceId = ResourceTable.id ) WHERE ( collectionId = :0 ) ORDER BY PimItemTable.id DESC" :  "MySQL server has gone away QMYSQL: Unable to execute query"

Reproducible: Always

Steps to Reproduce:
1. Configure Akonadi for use external MySQL server
2. Keep akonadi server runing without any task a some time (more then wait_timeout and interactive_timeout mysql variables)
3. Any activity after this time (I try simple getemails from my mailbox) produce SQL errors and fail to work.

Actual Results:  
Error during selection of record with id 0 from table "CollectionTable" "MySQL server has gone away QMYSQL: Unable to execute query" 
Error during executing query "SELECT PimItemTable.id, PimItemTable.remoteId, MimeTypeTable.name, ResourceTable.name, PimItemTable.rev, PimItemTable.remoteRevision, PimItemTable.size, PimItemTable.datetime, PimItemTable.collectionId FROM PimItemTable INNER JOIN MimeTypeTable ON ( PimItemTable.mimeTypeId = MimeTypeTable.id ) INNER JOIN CollectionTable ON ( PimItemTable.collectionId = CollectionTable.id ) INNER JOIN ResourceTable ON ( CollectionTable.resourceId = ResourceTable.id ) WHERE ( collectionId = :0 ) ORDER BY PimItemTable.id DESC" :  "MySQL server has gone away QMYSQL: Unable to execute query"

Expected Results:  
I think will be a good idea use mysql_ping (or exec "SELECT 1") for verify if MySQL connection is live, and if connection was lost, try reconnect to MySQL server before execute a query or return connection from DB poll.

PS. One more issue, not sure maybe it already fixed but when I try configure Akonadi to use external MySQL server it fail to initialize a new DB. DB was created, but tables not - so I was need move a tables from buildin MySQL to external.
Comment 1 Daniel Vrátil 2013-08-28 13:41:15 UTC
This has been fixed in current git and will be available in Akonadi 1.10.3. As you suggested, the Akonadi server is sending dummy queries to MySQL server from time to time to keep the connection alive.
Comment 2 Daniel Vrátil 2013-08-28 13:47:23 UTC
*** Bug 303922 has been marked as a duplicate of this bug. ***