Bug 175362 - The crash manager causing high cpu usage
Summary: The crash manager causing high cpu usage
Status: RESOLVED FIXED
Alias: None
Product: drkonqi
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: George Kiagiadakis
URL:
Keywords:
: 188531 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-17 01:50 UTC by Dan
Modified: 2009-05-02 03:58 UTC (History)
4 users (show)

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


Attachments
Valgrind output (kopete) (39.16 KB, text/plain)
2008-11-23 06:56 UTC, Dan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan 2008-11-17 01:50:07 UTC
Version:           svn (using Devel)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    Compiled sources

Athlon64 x2 5600+ (x86_64)

Everytime the Crash manager loads a backtrace, there's a high cpu usage until I close it.

Has anybody experienced that?
Comment 1 A. Spehr 2008-11-17 02:33:33 UTC
Yes. Generating backtraces is high on CPU usage. Or do you mean that it stays "high CPU", even the backtrace is generated? 
Comment 2 A. Spehr 2008-11-17 02:35:38 UTC
That should be "even *after* the backtrace is generated"...

Also, what svn version are you using? And what distro?
Comment 3 Dan 2008-11-17 06:16:52 UTC
Hi, yes, *even* after backtrace was generated. While the kde crash handler window is opened, there's a high cpu usage.

kdelibs: 885337
kdebase: 885337
Distribution: Linux from scratch
Comment 4 A. Spehr 2008-11-17 06:38:53 UTC
Well, that shouldn't happen. Is there anything in your distro's bugtracker on this? I can't confirm it, and neither can someone who is running x86_64 with a recent trunk. I guess my trunk is slightly older than yours. It's probably some kind of library error or something.
Comment 5 A. Spehr 2008-11-17 06:53:02 UTC
Actually, if you run "top", what does it say is taking up all the cpu?
Comment 6 George Kiagiadakis 2008-11-17 10:41:38 UTC
Sometimes it happens that the application that crashed takes 100% cpu usage while drkonqui is open, even if gdb has stopped generating the backtrace. It has happened to me 1-2 times but it's not reproducable.
Comment 7 Dan 2008-11-17 14:03:23 UTC
A. Spehr, here's the top output (as you can see, the crashed application -- kopete -- is using 100% of cpu. And it keeps this way until I close the crash handler window):

top - 11:00:44 up  1:17,  4 users,  load average: 1.50, 0.87, 0.79
Tasks: 128 total,   3 running, 125 sleeping,   0 stopped,   0 zombie
Cpu(s): 46.2%us,  3.8%sy,  0.0%ni, 49.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2059932k total,  1422008k used,   637924k free,    28988k buffers
Swap:   136512k total,   136508k used,        4k free,   478928k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                               
22411 fraga     20   0  428m  68m  22m S  100  3.4   1:09.75 kopete                                 
 2848 root      20   0  405m 178m 3284 S    0  8.9   1:35.72 X                                      
    1 root      20   0  3732  528  496 S    0  0.0   0:00.19 init                                   
    2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd                               
    3 root      RT  -5     0    0    0 S    0  0.0   0:00.00 migration/0                            
    4 root      15  -5     0    0    0 S    0  0.0   0:00.01 ksoftirqd/0                            
    5 root      RT  -5     0    0    0 S    0  0.0   0:00.02 migration/1                            
    6 root      15  -5     0    0    0 S    0  0.0   0:00.02 ksoftirqd/1                            
Comment 8 A. Spehr 2008-11-22 19:56:09 UTC
And this is 100% reproducible for you? Can you run it under valgrind and then crash? And see if you get useful output?
Comment 9 Dan 2008-11-23 06:56:35 UTC
Created attachment 28756 [details]
Valgrind output (kopete)
Comment 10 Dan 2008-11-23 06:58:40 UTC
Hi Spehr, I ran Kopete with valgrind and the output is attached. But I can't even use the Kopete app. It crashed when it was connecting... so probably it is not usefull... Would it be better to use strace instead?
Comment 11 George Kiagiadakis 2008-11-29 01:04:31 UTC
I can actually reproduce this reliably now.... the process that calls drkonqui seems to hang around kdeui/utils/kcrash.cpp:412 (this is intended) and consume 100% cpu usage while it is there (this is not intended). Tested with today's trunk (r8900xx).
Comment 12 George Kiagiadakis 2008-11-30 20:09:08 UTC
This is very tricky... I just crashed plasma and it did not eat any cpu while the crash handler was open, although it was looping around the same loop at kcrash.cpp:412. This bug only seems to happen with kopete! My guess is that kopete uses some low level unix stuff that makes that sleep(1); call in kcrash.cpp:412 not to work...
Comment 13 George Kiagiadakis 2009-02-27 13:20:23 UTC
I think I now understand the reason why this happens. The crash handler only runs in one thread and makes only this thread sleep. All the other threads continue running somehow, so this causes a lot of cpu usage. I'll try to investigate more and fix it.
Comment 14 George Kiagiadakis 2009-02-27 14:12:16 UTC
SVN commit 932785 by gkiagia:

Stop the crashed process while it's not being debugged.
This will avoid having high cpu usage by the other threads of that process.
CCBUG: 175362


 M  +14 -3     backtracegenerator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=932785
Comment 15 Dan 2009-02-28 05:20:07 UTC
(In reply to comment #14)
> SVN commit 932785 by gkiagia:
> 
> Stop the crashed process while it's not being debugged.
> This will avoid having high cpu usage by the other threads of that process.

Ok, this seems to solve the problem. Thanks.
Comment 16 George Kiagiadakis 2009-03-08 19:27:09 UTC
I reopen this bug as I'd like to keep it as a reminder of the fixes that have been commited to /branches/work/drkonqi-newdialog but not in trunk.

This bug will be closed when this code is moved to trunk.
Comment 17 Pino Toscano 2009-03-31 14:25:37 UTC
*** Bug 188531 has been marked as a duplicate of this bug. ***
Comment 18 Dario Andres 2009-05-02 03:58:11 UTC
The new DrKonqi implementation was moved to 4.3trunk.