X

Katsumi's Blog

pstack(or thread stack) for Windows to diagnose Firefox high CPU usage

After I upgraded my Firefox, I've been suffering with CPU usage shoot up issue.
My PC is 4 core so CPU stuck at near 25% probably means single thread is in tight loop.

I recycled my old knowledge and wrote a script to dump stacktrace of a busy thread.

merging Java thread dump and native thread dump

Windows windbg/cdb.
You can sort of merge it with Java thread dump with this perl

I used a Microsoft tool called 'pslist.exe' and I wrote about it in my last entry.
Here's a sample output when I reproduced the firefox bug reported here.

$ pstack.sh firefox
0:055> cdb: Reading initial command '~26kL 2;q'
*** ERROR: Symbol file could not be found. Defaulted to export symbols for xul.dll -
Child-SP RetAddr Call Site
00000000`104a77a8 104a7908`104a9574 xul!XRE_ParseAppData+0x1a3bae
00000000`104a77b0 613325d0`00000003 0x104a7908`104a9574
quit:
0:055> cdb: Reading initial command '~26kL 2;q'
*** ERROR: Symbol file could not be found. Defaulted to export symbols for xul.dll -
Child-SP RetAddr Call Site
00000000`104ac59c 00000040`62664bd5 xul!sh::Varying::isSameVaryingAtLinkTime+0xfa2b4
00000000`104ac5a4 3216fa24`104ad56c 0x00000040`62664bd5
quit:
0:055> cdb: Reading initial command '~26kL 2;q'
*** ERROR: Symbol file could not be found. Defaulted to export symbols for xul.dll -
Child-SP RetAddr Call Site
00000000`104ac5bc 00008000`62664de1 xul!sh::Varying::isSameVaryingAtLinkTime+0x762a5
00000000`104ac5c4 00008000`104ac710 0x00008000`62664de1
quit:
0:055> cdb: Reading initial command '~26kL 2;q'
*** ERROR: Symbol file could not be found. Defaulted to export symbols for xul.dll -
Child-SP RetAddr Call Site
00000000`104a77a8 104a7908`104a9574 xul!XRE_ParseAppData+0x1a3bae

While writing this quick&dirty script, I realized that it is not possible to use 'permanent' thread id
in cdb Windows debugger so this script may not work when threads are spawned or die while running.
Oracle DB for Windows may show a similar symptom like below for valid or invalid reason.
But I don't think attaching with debugger is supported.


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.