I read somewhere that you can prevent deadlock by considering JVM dump.
I really dont know much about JVM dump. How does it work?
May someone show this by a very simple code about deadlock and how to find deadlock in that code by JVM dump?
I read somewhere that you can prevent deadlock by considering JVM dump.
I really dont know much about JVM dump. How does it work?
May someone show this by a very simple code about deadlock and how to find deadlock in that code by JVM dump?
Found this link on the googling but couldn’t derive any inference from it.
http://publib.boulder.ibm.com/infocenter/javasdk/v1r4m2/index.jsp?topic=/com.ibm.java.doc.diagnostics.142/html/jvm_dump_initiation.html
yes, even i would like to know about this.
I think maybe you’re referring to a JVM thread dump.
The JVM supports this by sending the “quit” signal to the JVM process. Doing so will will show the stacks of every thread running in the JVM. If your application is stalled (deadlocked) you can use this thread dump to see what’s going on in each thread.
If you’re running a linux type system you can issue a signal by “kill -QUIT <pid>” where pid is the process id of the JVM. You can also do a “Ctrl+\” if running in the console. In windows it’s “Ctrl+Break”, but if you’re not running in a console you can use this program called SendSignal, which can be found on http://www.latenighthacking.com/.
I’ve found this to be very useful at times when a Java application hangs.
IBM link posted by Vikrant allows you to specify options on having these thread dumps generated automatically on errors.
Could you show me how to use JVM thread dump to find deadlock?
I mean a very simple program that has deadlock , extract its thread dump and point how to use thread dump of that code to find deadlock
Thanks in advance.
Anyone?
See this code example from the Sun web site:
So I’ve run this and it deadlocks, then (on Windows) I find the PID of the Java process running by looking in the task manager, in this case it’s 2380. Then I run “SendSignal.exe” in a command prompt:
SendSignal 2380
I won’t post the whole thing since it’s long, but here’s the important part:
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x02a6fabc (object 0x229bd860, a test.Deadlock$Friend),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x02a7131c (object 0x229bd870, a test.Deadlock$Friend),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at test.Deadlock$Friend.bowBack(Deadlock.java:22)
- waiting to lock <0x229bd860> (a test.Deadlock$Friend)
at test.Deadlock$Friend.bow(Deadlock.java:18)
- locked <0x229bd870> (a test.Deadlock$Friend)
at test.Deadlock$2.run(Deadlock.java:36)
at java.lang.Thread.run(Unknown Source)
"Thread-0":
at test.Deadlock$Friend.bowBack(Deadlock.java:22)
- waiting to lock <0x229bd870> (a test.Deadlock$Friend)
at test.Deadlock$Friend.bow(Deadlock.java:18)
- locked <0x229bd860> (a test.Deadlock$Friend)
at test.Deadlock$1.run(Deadlock.java:31)
at java.lang.Thread.run(Unknown Source)
Found 1 deadlock.
So here it shows you that two threads are both stuck at “Deadlock.java:22”.
jconsole comes w/ the JDK.
http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html#thread
you’re welcome. It’s what rozner described but w/ GUI.
I use Netbeans,I press CTRL-BREAK while I run that program , but I didn’t see anything.
I search and find about Netbeans:
But I didn’t see any link to download this add on…
and don’t find that on Netbeans…
I also try SendSignal in cmd…But unlucky…I don’t know how to find the ID of process that is belongs to program that I run …
I want to see thread dump. What is the simplest way?
The path to a secure application ,IBM
e. Race conditions
Two processes might share control or data. Race conditions is
the term applied to compromising this sharing, which typically
results from synchronization errors, when the potential exists
for process conflicts, and a resulting vulnerability. A typical
exploit interrupts a pair of sequential calls that are meant to be
performed automatically without interruption by another
thread or process on the machine with a third process.
One example is the combined checking of access rights to a
file, followed by a subsequent call to write or read that file. By
interrupting the process between the two calls, an attacker can
rewrite or modify the file because this behavior is expected.
The attacker can place inappropriate information into a file,
or perhaps access an inappropriate file
May someone explain more about the example?