How to detect a deadlock in BEA Weblogic using a JVM thread dump?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rasmus_Pedersen
Posted On:   Friday, October 11, 2002 12:38 AM

The appserve we use is BEA Weblogic 5.1 sp 8. That is not the important part. The question is how to read the thread dump I get in order to detect a deadlock. I have created a simple java program (inserted at the end of this question) that creates a deadlock, and I can see that my first worker thread is blocking access to the monitor for the second thread. And the thread dump(pasted below the code) shows this as the second thread waiting for the monitor with the same address. But now the tricky part: When I take a thread dump i bea weblogic I can see quite a few threads, but I does not appear that any thread is waiting for the same monitor or on one another. However, from the outside the system did not answer any HTTP   More>>

The appserve we use is BEA Weblogic 5.1 sp 8. That is not the important part.

The question is how to read the thread dump I get in order to detect a deadlock.

I have created a simple java program (inserted at the end of this question) that creates a deadlock, and I can see that my first worker thread is blocking access to the monitor for the second thread. And the thread dump(pasted below the code) shows this as the second thread waiting for the monitor with the same address.

But now the tricky part: When I take a thread dump i bea weblogic I can see quite a few threads, but I does not appear that any thread is waiting for the same monitor or on one another. However, from the outside the system did not answer any HTTP queries even with the expected response code 200.

Can anyone say how to detect a deadlock in a large thread dump? Is there a utility? A good article? (I am aware and have read one from Bea on www.ded2dev.com).

Thanks, Rasmus

JAVA CODE (not formatted for HTML):

public class Main {
/** Creates a new instance of Main */
public Main() {
}

public static void main(String[] args) {
Work w;
Work w2;
Main me;

me = new Main();

// Den blokerende tråd som aldring kommer ud af Main.go
w = new Work();
w.me = me;
w.setName("Den_blokernende_tråd");
w.start();

w2 = new Work();
w2.me = me;
w2.setName("Den_tråd_der_ikke_kan_køre");
w2.start();
}

public void go(Work wref){
boolean foreverGo = true;
int counter = 0;
synchronized(this) {
while(foreverGo==true){
counter++;
wref.workcounter++;
System.out.println(counter);
}
}
}
}

class Work extends Thread{
Main me;
int workcounter;

// Kalder op til Main's go metode
public void run() {
//I will call go and die
me.go(this);
}
}

THREAD DUMP FROM ILLUSTRATIONAL PROGRAM:

45602Full thread dump Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode):

"Thread-3" prio=5 tid=0x00284C98 nid=0x84c waiting on monitor [0..6fb14]

"Den_tr├Ñd_der_ikke_kan_k├©re" prio=5 tid=0x00981CD0 nid=0x87c waiting for monitor entry [aeef000..a
4]
at Main.go(Main.java:29)
- waiting to lock <02F01C38> (a Main)
at Work.run(Main.java:45)

"Den_blokernende_tråd" prio=5 tid=0x00980A20 nid=0x878 runnable [aeaf000..aeafdb4]
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
- locked <02F0A760> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(Unknown Source)
- locked <02F05D30> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder.flushBuffer(Unknown Source)
- locked <02F05CF0> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flushBuffer(Unknown Source)
at java.io.PrintStream.write(Unknown Source)
- locked <02F05D30> (a java.io.PrintStream)
at java.io.PrintStream.print(Unknown Source)
at java.io.PrintStream.println(Unknown Source)
- locked <02F05D30> (a java.io.PrintStream)
at Main.go(Main.java:32)
- locked <02F01C38> (a Main)
at Work.run(Main.java:45)

"Signal Dispatcher" daemon prio=10 tid=0x008E2FA8 nid=0x870 waiting on monitor [0..0]

"Finalizer" daemon prio=9 tid=0x008DF740 nid=0x864 waiting on monitor [ad6f000..ad6fdb4]
at java.lang.Object.wait(Native Method)
- waiting on <02F05E20> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <02F05E20> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" daemon prio=10 tid=0x0AAB03B0 nid=0x860 waiting on monitor [ad2f000..ad2fdb4]
at java.lang.Object.wait(Native Method)
- waiting on <02F01CA0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Unknown Source)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <02F01CA0> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=5 tid=0x00982218 nid=0x820 runnable

"VM Periodic Task Thread" prio=10 tid=0x008E1C40 nid=0x868 waiting on monitor

"Suspend Checker Thread" prio=10 tid=0x008E25B0 nid=0x86c runnable

   <<Less
About | Sitemap | Contact