[Kde-pim] Review Request 114341: Fix a bug in kmail that eats all cpu
Raul Fernandes
rgfernandes at gmail.com
Sat Dec 7 18:42:50 GMT 2013
> On Dec. 7, 2013, 12:12 p.m., Laurent Montel wrote:
> > Do you have a trace which shows this problem ?
> > That it's call all the time ?
> >
> > Regards
Yes.
I've profiled the kmail to see where the problem occurs.
I've saw that the QueryBuilder::exec() is called too much (and 2 functions from QueryCache class).
In a few seconds, this function is called 128.000 times.
So I put a qDebug in QueryBuilder::exec().
#else
mStatement = statement;
#endif
qDebug() << "QueryBuilder::exec() - Statement: " << statement;
return true;
}
So I got the log that I upload to review.
If you do this command:
$ cat log | grep "SELECT CollectionTable.id, CollectionTable.remoteId, CollectionTable.remoteRevision, CollectionTable.name, CollectionTable.parentId, CollectionTable.resourceId, CollectionTable.subscribed, CollectionTable.cachePolicyInherit, CollectionTable.cachePolicyCheckInterval, CollectionTable.cachePolicyCacheTimeout, CollectionTable.cachePolicySyncOnDemand, CollectionTable.cachePolicyLocalParts, CollectionTable.queryString, CollectionTable.queryLanguage, CollectionTable.isVirtual FROM CollectionTable WHERE ( parentId = :0 )" | wc -l
You will get:
74972
There are 74972 statements exactly equals in a few seconds of execution.
So I see the code to find where this calls are made.
That's how I find that initFolders() is causing the bug.
To test it, I put a disconnect() in slotDefaultCollectionsChanged() and the problem disapears.
- Raul
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114341/#review45295
-----------------------------------------------------------
On Dec. 7, 2013, 11 a.m., Raul Fernandes wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/114341/
> -----------------------------------------------------------
>
> (Updated Dec. 7, 2013, 11 a.m.)
>
>
> Review request for KDEPIM.
>
>
> Bugs: 323929
> http://bugs.kde.org/show_bug.cgi?id=323929
>
>
> Repository: kdepim
>
>
> Description
> -------
>
> The bug is described in https://bugs.kde.org/show_bug.cgi?id=323929.
> The bug triggers several queries to akonadi to get the same information.
> I think it is caused by the repeated connect() calls in initFolders() function (even using the Qt::UniqueConnection).
> So everytime the function slotDefaultCollectionsChanged() is called, disconnect the signal to avoid accumulate multiple signals.
> I think the right way is to rewrite the initFolders to call connect() only once.
> Split initFolders() in 2 functions. One is called by kmail and another (with the connect()) called by slotDefaultCollectionsChanged().
> For now, the disconnect() should be a good workaround for the (critical) bug.
>
>
> Diffs
> -----
>
> mailcommon/kernel/mailkernel.cpp 5b92778
>
> Diff: http://git.reviewboard.kde.org/r/114341/diff/
>
>
> Testing
> -------
>
> Until now, it is ok here.
>
>
> Thanks,
>
> Raul Fernandes
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list