irockel / tda Goto Github PK
View Code? Open in Web Editor NEWTDA - Thread Dump Analyzer
License: GNU Lesser General Public License v2.1
TDA - Thread Dump Analyzer
License: GNU Lesser General Public License v2.1
TDA should support parsing of jstack Dumps, see here:
http://stackoverflow.com/questions/7648570/how-to-interpret-a-java-thread-dump
Moved from here: https://java.net/jira/browse/TDA-37
I read thread dumps all the time that will have thousands of threads doing exactly the same.. and they are all idle:
"Remoting "g61mps-jhq01_HQ:HQserver:MANAGEMENT" task-16" #3237 prio=5 os_prio=0 tid=0x00007fd7040d6800 nid=0xd097 waiting on condition [0x00007fd655cb9000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000005cc27c558> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Locked ownable synchronizers:
- None
"Remoting "g61mps-jhq01_HQ:HQserver:MANAGEMENT" task-15" #3236 prio=5 os_prio=0 tid=0x00007fd7042bd000 nid=0xd096 waiting on condition [0x00007fd655dba000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000005cc27c558> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Think of thousands like this.
It would be nice if you could have a view of similar threads...
Group1:
java.lant.thread.State... (and then if you open the thread.. you could open the monitors.. and then the threads itself).
It would be really helpful.. I with I had time to contribute :(
VisualVM 2.0 has been released and does not support plugins for VisualVM 1.x.
You may want to update the TDA plugin for VisualVM 2.0. Changing imports from com.sun.tools.visualvm.*
to org.graalvm.visualvm.*
and updating dependency versions should be enough.
I'm ready to provide any assistance if needed.
Version: 2.3.4
Java version: 8
Thread dump done via jstack.
Even if I use files with same content but different names, no long running thread is found.
The following exception can happen while parsing a thread dump:
Exception in thread "Thread-3" java.lang.StringIndexOutOfBoundsException: String
index out of range: -73
at java.lang.String.substring(Unknown Source)
at com.pironet.tda.SunJDKParser.getThreadTokens(SunJDKParser.java:698)
at com.pironet.tda.AbstractDumpParser.addToCategory(AbstractDumpParser.j
ava:221)
at com.pironet.tda.SunJDKParser.parseNext(SunJDKParser.java:192)
at com.pironet.tda.SunJDKParser.hasMoreDumps(SunJDKParser.java:73)
at com.pironet.tda.TDA.addThreadDumps(TDA.java:1099)
at com.pironet.tda.TDA.access$900(TDA.java:123)
at com.pironet.tda.TDA$4.construct(TDA.java:703)
at com.pironet.tda.utils.SwingWorker$2.run(SwingWorker.java:131)
at java.lang.Thread.run(Unknown Source)
This patch fixes it:
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -1023,7 +1023,7 @@
if (name.indexOf("prio") > 0) {
tokens = new String[7];
- tokens[0] = name.substring(1, name.lastIndexOf('"'));
+ tokens[0] = name.substring(1, name.lastIndexOf('"') == 0 ? name.length() - 1 : name.lastIndexOf('"'));
tokens[1] = name.indexOf("daemon") > 0 ? "Daemon" : "Task";
String strippedToken = name.substring(name.lastIndexOf('"') + 1);
@@ -1078,16 +1078,19 @@
}
} else {
tokens = new String[3];
- tokens[0] = name.substring(1, name.lastIndexOf('"'));
+ tokens[0] = name.substring(1, name.lastIndexOf('"') == 0 ? name.length() - 1 : name.lastIndexOf('"'));
if (name.indexOf("nid=") > 0) {
tokens[1] = name.substring(name.indexOf("nid=") + 4, name.indexOf("state=") - 1);
tokens[2] = name.substring(name.indexOf("state=") + 6);
} else if (name.indexOf("t@") > 0) {
tokens[1] = name.substring(name.indexOf("t@") + 2, name.indexOf("state=") - 1);
tokens[2] = name.substring(name.indexOf("state=") + 6);
- } else {
+ } else if (name.indexOf("id=") > 0) {
tokens[1] = name.substring(name.indexOf("id=") + 3, name.indexOf(" in"));
tokens[2] = name.substring(name.indexOf(" in") + 3);
+ } else {
+ tokens[1] = "";
+ tokens[2] = "";
}
}
While parsing of JDK 8 dump files i have got an error:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "5 os_prio=0"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:419)
at java.lang.Long.<init>(Long.java:678)
at com.pironet.tda.utils.ThreadsTableModel.getValueAt(ThreadsTableModel.java:80)
at com.pironet.tda.utils.TableSorter.getValueAt(TableSorter.java:285)
Because of there an os_prio clumn between prio and tid columns present.
I have made a stupid fix and problem has gone. See below.
Index: src/java/com/pironet/tda/SunJDKParser.java
===================================================================
--- src/java/com/pironet/tda/SunJDKParser.java (revision 4)
+++ src/java/com/pironet/tda/SunJDKParser.java (revision 5)
@@ -1029,7 +1029,10 @@
String strippedToken = name.substring(name.lastIndexOf('"') + 1);
if (strippedToken.indexOf("tid=") >= 0) {
- tokens[2] = strippedToken.substring(strippedToken.indexOf("prio=") + 5, strippedToken.indexOf("tid=") - 1);
+ final int tidIndex = strippedToken.indexOf("tid=") - 1;
+ final int osPrioIndex = strippedToken.indexOf("os_prio=") - 1;
+ final int endIndex = osPrioIndex > 0 ? osPrioIndex : tidIndex;
+ tokens[2] = strippedToken.substring(strippedToken.indexOf("prio=") + 5, endIndex);
} else {
tokens[2] = strippedToken.substring(strippedToken.indexOf("prio=") + 5);
}
Merged from here: https://java.net/jira/browse/TDA-42
Currently, categories reference the assigned filters by name. If the name of a
filter is changed, the category no longer is able to locate the filter. The
correct relationship is to have the category hold a reference to the filter object.
Deleting a filter currently does not check to determine if a filter is currently
being referenced by a category. Filters that are referenced by a category should
not be deleted.
Merged from here: https://java.net/jira/browse/TDA-28
@irockel I see that there are two versions of TDA out there.
See the other one here:
https://github.com/mkbrv/tda
Any chance to merge development efforts to one project?
The other project by @mkbrv has the advantage of using maven builds.
Merged from JIRA: https://java.net/jira/browse/TDA-40
A pragmatic patch is attached.
The patch also replaces JFileChooser with the AWT = native FileDialog to give better navigation to log files by enabling OS native features for file selection and directory navigation
I won't open another issue for this at the moment, as both changes affect TDA.java (lazy mode )
When I update a category I have to close the file and reopen it, for the changes to take effect.
I would like to do this with a manual reload-button.
The most convenience solution that I can think of would automaticallly reload and activate the filter, without changing the UI.
Moved from here: https://java.net/jira/browse/TDA-34
At present the Monitors list is unsorted. It would be extremely useful if it
could be sorted by the classname of the monitor, as these are often closely
related, and typically there are just one or two classes you really care about.
There's an argument for making the sorting configurable so you could sort by
either class name or object address, but I think if time is tight then sorting
by class name would be more useful.
Moved from here: https://java.net/jira/browse/TDA-16
When I close any dialog window with [x] button the GUI stops responding and I need to restart TDA.
Microsoft Windows 7 Enterprise, 64-bit
Oracle JDK 1.8.0_91.
Thread dumps from JDK 11 include cpu= and elapsed= fields in each thread's first line with different value for each dump.
TDA does not detect any threads to be long running. It seems TDA uses also those /value varying/ fields for comparison causing no thread can ever match each other (see my TDA output at the botoom).
Example - folowing two threads are NOT detected as long running. But they have the same call stack.
dump1:
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 cpu=55652.75ms elapsed=107142.81s tid=0x00007f4b3883d000 nid=0x10854 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
No compile task
dump2:
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 cpu=55652.76ms elapsed=107145.12s tid=0x00007f4b3883d000 nid=0x10854 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
No compile task
TDA outputs:
Dump No. 2, Dump No. 3
Overall Thread Count 0
Minimum Occurence of threads 2
No threads were found which occured at least 2 times. You should check your dumps for long running threads or adjust the minimum occurence.
How can I use "find long running threads"? I don't understand the regular expression I'm supposed to use.
No matter what I do I don't get any result (I can provide the dump in private)
Selection is not handled properly in the right top pane.
Reproduction (Sorry for the complicated explanation):
Moved from here: https://java.net/jira/browse/TDA-32
Thread dumps from JDK 11.0.1 and 12+ now include cpu=
and elapsed=
fields in each thread's first line, e.g.:
"main" #1 prio=5 os_prio=0 cpu=1124.82ms elapsed=116459.50s tid=0x00007f6aec016800 nid=0xaba runnable [0x00007f6af4245000] java.lang.Thread.State: RUNNABLE
See https://bugs.openjdk.java.net/browse/JDK-8200720 for where this was added.
tda seems to parse these fields in normal threads, but chokes on these fields in the 'system' threads at the end. For instance, given this thread dump:
2020-04-16 02:53:41
Full thread dump OpenJDK 64-Bit Server VM (11.0.6+10 mixed mode):
"main" #1 prio=5 os_prio=0 cpu=1124.82ms elapsed=116459.50s tid=0x00007f6aec016800 nid=0xaba runnable [0x00007f6af4245000]
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept([email protected]/Native Method)
at java.net.AbstractPlainSocketImpl.accept([email protected]/AbstractPlainSocketImpl.java:458)
at java.net.ServerSocket.implAccept([email protected]/ServerSocket.java:565)
at java.net.ServerSocket.accept([email protected]/ServerSocket.java:533)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:466)
at org.apache.catalina.startup.Catalina.await(Catalina.java:776)
at org.apache.catalina.startup.Catalina.start(Catalina.java:722)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0([email protected]/Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke([email protected]/NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke([email protected]/Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Locked ownable synchronizers:
- None
"Reference Handler" #2 daemon prio=10 os_prio=0 cpu=74835.02ms elapsed=116459.48s tid=0x00007f6aec0a8800 nid=0xabe waiting on condition [0x00007f6ab3af8000]
java.lang.Thread.State: RUNNABLE
at java.lang.ref.Reference.waitForReferencePendingList([email protected]/Native Method)
at java.lang.ref.Reference.processPendingReferences([email protected]/Reference.java:241)
at java.lang.ref.Reference$ReferenceHandler.run([email protected]/Reference.java:213)
Locked ownable synchronizers:
- None
"VM Thread" os_prio=0 cpu=1400820.85ms elapsed=116459.49s tid=0x00007f6aec0a0000 nid=0xabc runnable
"ParGC Thread#0" os_prio=0 cpu=531433.46ms elapsed=116459.51s tid=0x00007f6aec040000 nid=0xabb runnable
"ParGC Thread#1" os_prio=0 cpu=532378.30ms elapsed=116452.11s tid=0x00007f6aac005000 nid=0xb35 runnable
"ParGC Thread#2" os_prio=0 cpu=531378.18ms elapsed=116452.11s tid=0x00007f6aac006800 nid=0xb36 runnable
"ParGC Thread#3" os_prio=0 cpu=531444.52ms elapsed=116452.10s tid=0x00007f6aac008000 nid=0xb37 runnable
"ParGC Thread#4" os_prio=0 cpu=531319.95ms elapsed=116452.10s tid=0x00007f6aac009800 nid=0xb38 runnable
"ParGC Thread#5" os_prio=0 cpu=531506.14ms elapsed=116452.10s tid=0x00007f6aac00b000 nid=0xb39 runnable
"ParGC Thread#6" os_prio=0 cpu=531183.48ms elapsed=116452.10s tid=0x00007f6aac00c800 nid=0xb3a runnable
"ParGC Thread#7" os_prio=0 cpu=532862.62ms elapsed=116452.10s tid=0x00007f6aac00e000 nid=0xb3b runnable
"ParGC Thread#8" os_prio=0 cpu=531416.13ms elapsed=116436.06s tid=0x00007f6aac015000 nid=0xcf8 runnable
"ParGC Thread#9" os_prio=0 cpu=531990.95ms elapsed=116436.06s tid=0x00007f6aac016800 nid=0xcf9 runnable
"VM Periodic Task Thread" os_prio=0 cpu=60646.16ms elapsed=116459.40s tid=0x00007f6aec18f000 nid=0xaca waiting on condition
JNI global refs: 173, weak refs: 5
TDA fails to render the right pane when asked to render the latter threads, and a stacktrace appears in the console:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "0 cpu=1400820.85ms elapsed=116459.49s"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Long.parseLong(Long.java:692)
at java.base/java.lang.Long.<init>(Long.java:1317)
at com.pironet.tda.utils.ThreadsTableModel.getValueAt(ThreadsTableModel.java:80)
at com.pironet.tda.utils.TableSorter.getValueAt(TableSorter.java:285)
at java.desktop/javax.swing.JTable.getValueAt(JTable.java:2706)
...
Also, jstack
now has a -e
'extended' listing (also settable with (-XX:+PrintExtendedThreadInfo
) which adds allocated=
and defined_classes=
fields:
"main" #1 prio=5 os_prio=0 cpu=1443.71ms elapsed=82664.33s allocated=48483K defined_classes=2975 tid=0x00007f5484016800 nid=0x2a7 runnable [0x00007f5489c16000]
java.lang.Thread.State: RUNNABLE
Visualvm under jdk1.8.0_131-window32 in Isolated machine
connected to remote host via JMX running
JVM: IBM J9 VM (2.6, JRE 1.6.0 Windows 7 x86-32 20150701_255671 (JIT enabled, AOT enabled)
J9VM - R26_Java626_SR8_20150701_0100_B255671
JIT - tr.r11_20150626_95120.01
GC - R26_Java626_SR8_20150701_0100_B255671
J9CL - 20150701_255671)
Java: version 1.6.0, vendor IBM Corporation
When I do thread dump I get
2017-10-06 14:08:56
Full thread dump IBM J9 VM (2.6 JRE 1.6.0 Windows 7 x86-32 20150701_255671 (JIT enabled, AOT enabled)
J9VM - R26_Java626_SR8_20150701_0100_B255671
JIT - tr.r11_20150626_95120.01
GC - R26_Java626_SR8_20150701_0100_B255671
J9CL - 20150701_255671):
"P=274803:O=0:CT" - Thread t@1
java.lang.Thread.State: TIMED_WAITING
at java.lang.Thread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:914)
at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:710)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:400)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:163)
Locked ownable synchronizers:
- None
"JIT Compilation Thread-0" - Thread t@12
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"JIT Compilation Thread-1 Suspended" - Thread t@13
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"JIT Compilation Thread-2 Suspended" - Thread t@14
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
Window show but error appear in
D:\Users\user\AppData\Roaming\VisualVM\8u131\var\log\messages.log.1
i see:
SEVERE [global]
java.lang.NullPointerException
at com.pironet.tda.SunJDKParser.parseNext(SunJDKParser.java:276)
at com.pironet.tda.SunJDKParser.hasMoreDumps(SunJDKParser.java:74)
at com.pironet.tda.TDA.addThreadDumps(TDA.java:1335)
at com.pironet.tda.TDA.access$1500(TDA.java:119)
at com.pironet.tda.TDA$5.construct(TDA.java:928)
at com.pironet.tda.utils.SwingWorker$2.run(SwingWorker.java:131)
[catch] at java.lang.Thread.run(Thread.java:748)
Couldn't find file: Collapsed.gif
Couldn't find file: Expanded.gif
INFO [org.netbeans.modules.autoupdate.updateprovider.DownloadListener]: Reading URL https://visualvm.github.io/uc/8u131/updates.xml.gz?unique=085ab219e-1f83-40ad-b107-dd693ee588c2_23e235a2-bdff-4ba5-aa00-54ae7257de64 failed (java.net.UnknownHostException: visualvm.github.io)
SEVERE [global]
java.lang.NullPointerException
at com.pironet.tda.SunJDKParser.parseNext(SunJDKParser.java:276)
at com.pironet.tda.SunJDKParser.hasMoreDumps(SunJDKParser.java:74)
at com.pironet.tda.TDA.addThreadDumps(TDA.java:1335)
at com.pironet.tda.TDA.access$1500(TDA.java:119)
at com.pironet.tda.TDA$5.construct(TDA.java:928)
at com.pironet.tda.utils.SwingWorker$2.run(SwingWorker.java:131)
[catch] at java.lang.Thread.run(Thread.java:748)
Check if Java 9 Thread dumps are still parseable to avoid having broken thread dumps for a longer time like in Java 8.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.