Bug 117989 - Kopete takes over two minutes to start up
Summary: Kopete takes over two minutes to start up
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: Statistics plugin (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 119529 133057 138903 219695 233640 247887 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-09 12:35 UTC by David Saxton
Modified: 2014-05-21 08:33 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Saxton 2005-12-09 12:35:41 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Ubuntu Packages

(2 minutes and 27 seconds on a very fast computer, to be exact).

Kopete takes a very long time to start up with a particular configuration. It will get as far as displaying its main window with toolbar icons and a menu, and then become unresponsive for over two minutes.

I don't think this is normal behaviour, (and if it is, it shouldn't be). So I ran valgrind/callgrind against the kopete with the configuration that takes a very long time to start up, and a control one one which starts up in a reasonable amount of time. Valgrind generated two output files for each kopete; the second one of each seemed to be the important one.

In the long-time start-up, there is a susipicious pattern:

Over ten million calls to QListViewItem::compare, and twenty million calls to KopeteMetaContactLVI::key (QListViewItem::compare seems to be calling KopeteMetaContactLVI::key twice for each call to itself).

In the control start-up, there are less than twenty thousand calls to QListViewItem::compare, and thirty thousand calls to KopeteMetaContactLVI::key. As this is a factor of 500 less, it could easily account for the long start-up time.

If anyone wants the valgrind/callgrind output file, it is 490 K when bzip2'd up.
Comment 1 Matt Rogers 2005-12-09 14:19:20 UTC
how many groups and contacts do you have?
Comment 2 David Saxton 2005-12-09 14:33:56 UTC
No groups; about a thousand contacts listed in the contact list (half of which seem to be empty).
Comment 3 Jan Ritzerfeld 2005-12-11 22:02:15 UTC
Is the statistics plugin enabled?
# grep "statistics" ~/.kde/share/config/kopeterc
kopete_statisticsEnabled=true
Comment 4 David Saxton 2005-12-11 22:06:03 UTC
The statistics plugin is not enabled. If you're interested, here's the plugin section from the config file:

[Plugins]
kopete_aimEnabled=true
kopete_aliasEnabled=false
kopete_autoreplaceEnabled=false
kopete_connectionstatusEnabled=false
kopete_contactnotesEnabled=false
kopete_cryptographyEnabled=false
kopete_highlightEnabled=false
kopete_historyEnabled=true
kopete_msnEnabled=true
kopete_nowlisteningEnabled=false
kopete_texteffectEnabled=true
kopete_translatorEnabled=true
kopete_webpresenceEnabled=false
Comment 5 Magno Alexandre Torres 2006-08-10 20:37:17 UTC
Hi,

Turn off kopete_statisticsEnabled, solve my problem...
But i like this feature, is possivel to fix this show plugin? 
Comment 6 Matt Rogers 2006-08-27 18:32:03 UTC
*** Bug 133057 has been marked as a duplicate of this bug. ***
Comment 7 Rinse De Vries 2007-02-18 12:49:50 UTC
disabling the statistic plugin (in the gui of kopete) made my kopete speed up from about 2 minutes to 2 seconds.
I heard others reporting the same.
I would like to suggest to turn the statistics plugin off by default, untill the startup delay has been solved..
Comment 8 Charles Connell 2008-01-23 20:37:58 UTC
Statistics is no longer enabled by default.
Comment 9 Matt Rogers 2008-01-24 03:07:30 UTC
but it will still take two minutes to start if it is enabled and the database is big enough.
Comment 10 Charles Connell 2008-01-24 04:18:44 UTC
Okay, will move bug to statistics plugin and address there.
Comment 11 Charles Connell 2008-01-24 04:21:38 UTC
*** Bug 119529 has been marked as a duplicate of this bug. ***
Comment 12 Charles Connell 2008-02-12 00:23:57 UTC
SVN commit 773881 by cconnell:

Optionally show date of messages in chatwindow
FEATURE:117989


 M  +4 -1      kopete/chatwindow/chatmessagepart.cpp  
 M  +72 -27    kopete/config/behavior/behaviorconfig_chat.ui  
 M  +4 -0      libkopete/kopetebehaviorsettings.kcfg  


WebSVN link: http://websvn.kde.org/?view=rev&revision=773881
Comment 13 Charles Connell 2008-02-12 00:24:44 UTC
That was the wrong bug number, sorry.
Comment 14 Dominik Tritscher 2008-07-20 14:18:17 UTC
Kopete 0.50.80 with enabled statistics plugin takes not more than 5sec to start. So seems to be fixed with KDE 4.1
Comment 15 Michael 2008-07-22 13:33:33 UTC
Kopete svn trunk r835161 with enabled Statistics plugin doesnt take longer than 5 sec to start here, too.

But i dont have a large enough db to test, so i cant tell if the size of the db matters.
Comment 16 Piotr Budny 2009-12-13 23:14:21 UTC
Got this problem on kde4-kdenetwork-kopete-4.3.4-1.i686.
iotop shows about 250KB/s transfer on kopete_statistics-0.1.db (~35MB) for few minutes.
App disconnects from jabber network, and is unresponsive.
Comment 17 Basti 2010-02-01 12:04:08 UTC
I can confirm Piotr. After using Kopete some time with statistics, it becomes slower, especially at going offline. I think the module should be removed until the bug is solved, because some friends of mine got the bug too. And here is someone else:
http://forum.ubuntuusers.de/topic/kopete-benoetigt-ewig-zum-starten/

Maybe bug 182587 is a duplicate of this.
Comment 18 Hakan Kilic 2010-03-14 20:21:38 UTC
Confirmed here.

Thank god, I had some free time and found it was the statistics plugin, It was slow as hell since KDE4.0 release. (It took 2mins of my life for a year and I did not notice :/ ) My kopete_statistics-0.1.db is now 30,2 megabytes. Disabling it works for me too.
Comment 19 Daniel Hahler 2010-04-07 20:47:05 UTC
*** Bug 233640 has been marked as a duplicate of this bug. ***
Comment 20 Ine Ya 2010-06-20 21:37:00 UTC
I'm lucky I found this page, and finally turned off that bloody thing (statistics plugin). This plugin needs some optimization or rewrite from scratch.
Comment 21 Lamarque V. Souza 2011-03-17 03:46:52 UTC
*** Bug 247887 has been marked as a duplicate of this bug. ***
Comment 22 Lamarque V. Souza 2011-03-20 02:28:05 UTC
SVN commit 1225336 by lvsouza:

Backporting r1225335 to 4.6.2: Use kapp->processEvents() to minimize statistics plugin blockage.
This does not solve the problem, Kopete feels sluggish when loading
statistics plugin even after this change (CPU still goes to 100% usage),
but it is better than blocking Kopete altogether.

CCBUG: 117989


 M  +3 -0      statisticsplugin.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1225336
Comment 23 Gunter Ohrner 2011-04-01 02:33:46 UTC
Actually I had not used Kopete since a few years (!) as it always took lots of minutes to start, eating all cpu time during this period, and I considered it to be simply broken.

Disabling the statistics plugin helped imediately.

I'd vote for a big, fat warning in the plugin's description which cannot be missen before enabling it...
Comment 24 Lamarque V. Souza 2011-04-10 07:07:30 UTC
SVN commit 1227533 by lvsouza:

Per metacontact statistics DB is created only when contact goes online
or when statistics for an offline metacontact is requested.
This improves plugin startup and shutdown times and also helps with UI
responsiveness.

Now shutdown time is proportional to the number of metacontacts that went
online since Kopete has started plus the number of offline metacontacts
that the user requested statistics from. That is better then being
proportional to the number of all metacontacts registered but is not that
good yet.

BUG: 117989, 138903
CCBUG: 246785
FIXED-IN: 4.6.3


 M  +34 -2     statisticsplugin.cpp  
 M  +2 -0      statisticsplugin.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1227533
Comment 25 Lamarque V. Souza 2011-04-10 07:10:28 UTC
SVN commit 1227534 by lvsouza:

Backporting 1227533 to 4.6 branch:

Per metacontact statistics DB is created only when contact goes online
or when statistics for an offline metacontact is requested.
This improves plugin startup and shutdown times and also helps with UI
responsiveness.

Now shutdown time is proportional to the number of metacontacts that went
online since Kopete has started plus the number of offline metacontacts
that the user requested statistics from. That is better then being
proportional to the number of all metacontacts registered but is not that
good yet.

BUG: 117989, 138903
CCBUG: 246785
FIXED-IN: 4.6.3


 M  +34 -2     statisticsplugin.cpp  
 M  +2 -0      statisticsplugin.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1227534
Comment 26 Lamarque V. Souza 2011-04-10 07:12:07 UTC
*** Bug 138903 has been marked as a duplicate of this bug. ***
Comment 27 bigjools 2012-03-08 05:31:16 UTC
I don't have the statistics plugin enabled, and it still takes nearer 10 minutes to start up while eating 100% CPU.
Comment 28 Pali Rohár 2014-05-12 21:41:50 UTC
@bigjools: This could be problem in kabc akonadi plugin (there is problem with global mutex or something similar). Try to remove akonadi plugin from contact resources via:

$ kcmshell4 kresources
Comment 29 Pali Rohár 2014-05-13 10:01:58 UTC
Git commit 5f8ffd33235276beb5ebcbdac8c422b6250381de by Pali Rohár.
Committed on 12/05/2014 at 22:05.
Pushed by pali into branch 'master'.

Turn off synchronous mode for sqlite database in statistics plugin

Synchronous mode does not have any real advantages here and only slow down
writes to database. When it is turned off it can dramatically speed up kopete
statistics plugin when changing status from online to offline or on exit.

Tested with 150MB big database:
before patch: exit time about 10s
after patch: exit time about 1s

M  +10   -0    plugins/statistics/statisticsdb.cpp

http://commits.kde.org/kopete/5f8ffd33235276beb5ebcbdac8c422b6250381de
Comment 30 Pali Rohár 2014-05-13 10:02:37 UTC
Git commit d9a25c460cf1777eb2555cd8df72609800b25e20 by Pali Rohár.
Committed on 12/05/2014 at 22:05.
Pushed by pali into branch 'KDE/4.13'.

Turn off synchronous mode for sqlite database in statistics plugin

Synchronous mode does not have any real advantages here and only slow down
writes to database. When it is turned off it can dramatically speed up kopete
statistics plugin when changing status from online to offline or on exit.

Tested with 150MB big database:
before patch: exit time about 10s
after patch: exit time about 1s

M  +10   -0    plugins/statistics/statisticsdb.cpp

http://commits.kde.org/kopete/d9a25c460cf1777eb2555cd8df72609800b25e20
Comment 31 Roland Wolters 2014-05-21 08:33:23 UTC
*** Bug 219695 has been marked as a duplicate of this bug. ***