Bug 391783 - Akonadi is causing thousands of QSqlDatabase warnings
Summary: Akonadi is causing thousands of QSqlDatabase warnings
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: 5.7.2
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-12 21:38 UTC by Allan Sandfeld
Modified: 2018-03-15 16:39 UTC (History)
1 user (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 Allan Sandfeld 2018-03-12 21:38:00 UTC
QSqlDatabase is not thread safe and can not be used from multiple threads. This is however done massively in Akonadi.

Qt 5.11 will print millions of warnings due to this as they are now warning if you do this wrong.
Comment 1 Allan Sandfeld 2018-03-12 21:45:39 UTC
Actually, it might not be that wrong, it is just that QSqlQuery is at least temporarily in an illegal state when constructored by the querybuilder.
Comment 2 Allan Sandfeld 2018-03-12 22:39:54 UTC
Yes upon further investigation this mainly seems to be trigger by the use of default constructed QSqlQuery as a non-initialized null value, but that is not how Qt treats them, and they will try to connect to the default database and prepare to execute commands there.
Comment 3 Allan Sandfeld 2018-03-12 22:45:20 UTC
I wrote this change that seems to stop most of them: https://phabricator.kde.org/D11273
Comment 4 Allan Sandfeld 2018-03-13 10:42:20 UTC
The change in Qt that triggers this is https://codereview.qt-project.org/#/c/213515/
Comment 5 Albert Astals Cid 2018-03-15 16:39:39 UTC
Git commit 02445c3022c96c4cf8734034ec49c0cb9b05d1ea by Albert Astals Cid, on behalf of Allan Sandfeld Jensen.
Committed on 15/03/2018 at 16:39.
Pushed by aacid into branch 'master'.

Fix QSqlQuery warnings

Summary:
A default constructed QSqlQuery is not a passive null-value but a
query prepared for the default database which may not be allowed
in the current thread. Instead try connecting to the akonadi default
database.

Reviewers: mlaurent, dvratil

Reviewed By: dvratil

Subscribers: dvratil, ngraham, #kde_pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D11273

M  +4    -4    src/server/handler/fetchhelper.cpp
M  +2    -2    src/server/handler/list.cpp
M  +2    -1    src/server/storage/querybuilder.cpp

https://commits.kde.org/akonadi/02445c3022c96c4cf8734034ec49c0cb9b05d1ea