Bug 155904

Summary: kded4 excessive CPU usage
Product: [Frameworks and Libraries] kdelibs Reporter: Nick Warne <nick>
Component: kdedAssignee: David Faure <faure>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Services running

Description Nick Warne 2008-01-16 13:31:14 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          GCC 3.4.6 
OS:                Linux

SVN update from 15th Jan 2008.

Since starting to use KDE$, I am concerned of the excessive kded4 CPU usage - a constant 4%-6% load.

Here is top after X/KDE4 was up for 26 hours:

15977 nick      20   0 62068  20m  17m S  4.0  1.3  43:47.05 kded4
15906 root      20   0 71484  34m 5520 S  3.3  2.3   9:27.72 X

I think it is KDirWatch that is causing it, but I cannot see where this service is, nor how to turn it off.

I will attach screenshot of services running.

Nick
Comment 1 Nick Warne 2008-01-16 13:32:05 UTC
Created attachment 23072 [details]
Services running


Current services running.
Comment 2 David Faure 2008-01-18 13:19:28 UTC
You can try unloading kded modules one by one to see if one of them is guilty
$ qdbus org.kde.kded /kded loadedModules
favicons
networkstatus
kpasswdserver
kcookiejar
kwalletd

$ qdbus org.kde.kded /kded unloadModule networkstatus
true

But if KDirWatch is guilty, then that's part of the core kded functionality and cannot be unloaded.
Comment 3 Nick Warne 2008-01-18 14:02:23 UTC
OK, thanks for advice.

Turning off each loadedmodule, one-by-one, doesn't reveal anything... CPU usage still @ 4% - 6% constant.

I thne had a thought!  I mount / and /home 'noatime'.  So I remounted with that option removed, alas, still no change.

I have also just run kded4 through strace -f.

This reveals that 'stat64' polls/reads everything in my $HOME/.kde4 directory every second(ish).

Nick
Comment 4 Nick Warne 2008-01-18 14:28:25 UTC
OK, again thanks for the heads up.  I have resolved this issue on my system.

Googling revealed a 3.x.x thread that as FAM daemon isn't available, kded uses 'stat'.

'stat' polling can be controlled by entry in kdedrc thus:

[DirWatch]
PollInterval=60000

Here I have set it to 60 seconds.

This now leaves system happily purring along at 0% - 1%.

Nick
Comment 5 Cyrill Helg 2008-01-26 19:30:02 UTC
I added the options to kdedrc and installed/run famd but still my kded uses all my cpu all of the time.

Comment 6 David Faure 2008-01-28 16:18:24 UTC
> I added the options to kdedrc and installed/run famd but still my kded uses all my cpu all of the time.

Best way to find out why is to run "gdb --pid <pid>" and "bt" to see what it's doing...
Comment 7 Cyrill Helg 2008-03-07 22:57:41 UTC
Here is some debug output:

Reading symbols from /home/kde-devel/kde/lib/soprano/libsoprano_redlandbackend.so...done.
Loaded symbols for /home/kde-devel/kde/lib/soprano/libsoprano_redlandbackend.so
0xb3b02135 in librdf_hash_memory_find_node () from /usr/lib/librdf.so.0
(gdb) bt
#0  0xb3b02135 in librdf_hash_memory_find_node () from /usr/lib/librdf.so.0
Comment 8 David Faure 2008-07-01 12:26:01 UTC
Cyrill Helg: see bug 159027