Thread dump example


2011-04-12 09:18:25
Full thread dump OpenJDK 64-Bit Server VM (19.0-b09 mixed mode):

"Attach Listener" daemon prio=10 tid=0x0000000000b0d000 nid=0x33ef waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"DestroyJavaVM" prio=10 tid=0x00007f3a2408d000 nid=0x3391 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"File I/O" prio=10 tid=0x00007f3a2408b800 nid=0x33a2 runnable [0x00007f3a3157e000]
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.read(Native Method)
at ThreadDumpTest$4.run(ThreadDumpTest.java:97)
at java.lang.Thread.run(Thread.java:636)

"Blocked" prio=10 tid=0x00007f3a24081000 nid=0x33a1 waiting for monitor entry [0x00007f3a3167f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at ThreadDumpTest$3.run(ThreadDumpTest.java:74)
- waiting to lock <0x00000007d68b4068> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:636)

"Blocking" prio=10 tid=0x00007f3a2407f000 nid=0x33a0 in Object.wait() [0x00007f3a31780000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007d69de280> (a java.lang.Object)
at java.lang.Object.wait(Object.java:502)
at ThreadDumpTest$2.run(ThreadDumpTest.java:52)
- locked <0x00000007d69de280> (a java.lang.Object)
- locked <0x00000007d68b4068> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:636)

"Waiting" prio=10 tid=0x00007f3a2407e000 nid=0x339f in Object.wait() [0x00007f3a31881000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007d693ee00> (a java.lang.Object)
at java.lang.Object.wait(Object.java:502)
at ThreadDumpTest$1.run(ThreadDumpTest.java:26)
- locked <0x00000007d693ee00> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:636)

"Low Memory Detector" daemon prio=10 tid=0x00007f3a24001000 nid=0x339d runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"CompilerThread1" daemon prio=10 tid=0x0000000000b93000 nid=0x339c waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=10 tid=0x0000000000b90000 nid=0x339b waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x0000000000b8e800 nid=0x339a runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=10 tid=0x0000000000b6f000 nid=0x3398 in Object.wait() [0x00007f3a31dc5000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007d6801310> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
- locked <0x00000007d6801310> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)

"Reference Handler" daemon prio=10 tid=0x0000000000b67800 nid=0x3397 in Object.wait() [0x00007f3a31ec6000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007d68011e8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
- locked <0x00000007d68011e8> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=10 tid=0x0000000000b60800 nid=0x3396 runnable

"GC task thread#0 (ParallelGC)" prio=10 tid=0x0000000000b03000 nid=0x3392 runnable

"GC task thread#1 (ParallelGC)" prio=10 tid=0x0000000000b05000 nid=0x3393 runnable

"GC task thread#2 (ParallelGC)" prio=10 tid=0x0000000000b07000 nid=0x3394 runnable

"GC task thread#3 (ParallelGC)" prio=10 tid=0x0000000000b08800 nid=0x3395 runnable

"VM Periodic Task Thread" prio=10 tid=0x00007f3a2400c000 nid=0x339e waiting on condition

JNI global references: 869




import java.io.FileInputStream;
import java.util.concurrent.atomic.AtomicInteger;

public class ThreadDumpTest
{
static final Object o = new Object();

/**
* @param args
*/
public static void main(String[] args)
{
new Thread(new Runnable()
{
@Override
public void run()
{
Thread.currentThread().setName("Waiting");
// Waiting
try
{
System.out.println("Waiting");
Object x = new Object();
synchronized (x)
{
x.wait();
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println("Finished waiting");
}
}).start();

new Thread(new Runnable()
{
@Override
public void run()
{
Thread.currentThread().setName("Blocking");
// Blocking
synchronized (o)
{
try
{
System.out.println("Blocking");
Object x = new Object();
synchronized (x)
{
x.wait();
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println("Finished blocking");
}
}
}).start();

new Thread(new Runnable()
{
@Override
public void run()
{
Thread.currentThread().setName("Blocked");
// Blocked
System.out.println("Getting blocked");
synchronized (o)
{
System.out.println(Thread.currentThread().getName() + ": should have been blocked");
}
}
}).start();

new Thread(new Runnable()
{
final AtomicInteger sum = new AtomicInteger();

@Override
public void run()
{
// File I/O
Thread.currentThread().setName("File I/O");
FileInputStream fis;
try
{
fis = new FileInputStream("/home/tcollinsworth/Desktop/elekta-crash-1/jboss-elekta-1.trace");
System.out.println("Reading file");
int inByte = 0;
do
{
sum.addAndGet(inByte);
inByte = fis.read();
}
while (inByte != -1);
System.out.println("Finished reading file");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}).start();
}
}

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout

Locks held on Oracle for hours after sessions abnormally terminated by node failure