Java 2 SDK for Solaris features a new debugging process. It sends a SIGQUIT signal to a Java process running in the foreground. This signal causes the process to pause for user input after displaying the following menu:
1: Terminate program 2: Find & print one deadlock 3: Find & print all deadlocks 4: Print thread stacks 5: Print lock registry 6: Continue program |
Use the second and third options to search for Java level deadlocks (where two or more threads are involved in a cyclic wait for monitors). Careless use of synchronized methods in a multithreaded Java program can cause this kind of deadlock.
The fourth option provides a list of active threads in the system and lets you selectively obtain Java stack traces of these threads.
The fifth option produces a dump of the VM's internal locks. You might find this information useful when reporting VM-related problems or bugs.
You can send a SIGQUIT signal using kill(1) or by typing Ctrl-Backslash to a foreground process.
If you send the signal to a Java process running in the background, the output of options three, four, and five is dumped to the standard error device but the program continues to execute without pausing for user input.
The following trace illustrates a typical interaction scenario following the receipt of a SIGQUIT signal by the Java process.
... ^\SIGQUIT A SIGQUIT has been received. Do you want to: 1) terminate program 2) check & print one deadlock 3) check & print all deadlocks 4) dump thread stacks 5) dump lock registry 6) continue program Select Action: 2 Found 0 deadlock --------- Do you want to: 1) terminate program 2) check & print one deadlock 3) check & print all deadlocks 4) dump thread stacks 5) dump lock registry 6) continue program Select Action: 4 List of Java Threads: -------------------- [Thread# 1] t@9: (0xef715af4) GC-like thread, or damaged thread [Thread# 2] t@8: "Thread-4" [Thread# 3] t@7: "SoftReference sweeper" [Thread# 4] t@6: "Finalizer" [Thread# 5] t@5: "Reference handler" [Thread# 6] t@4: "Signal dispatcher" [Thread# 7] t@1: "main" Choose an index (1 to 7) to dump thread stack. 8 or greater returns you to the previous menu: 7 "main" (TID:0x36adc, sys_thread_t:0x36a50, state:R, thread_t: t@1, threadID:0x20f68, stac k_bottom:0xf0000000, stack_size:0x20000) prio=5 [1] java.lang.Thread.yield(Thread.java) [2] PingPoll.run(Compiled Code @ 0x117300) [3] PingPoll.main(Compiled Code @ 0x1172c8) ------------------- Choose an index (1 to 7) to dump thread stack. 8 or greater returns you to the previous menu: 8 --------- Do you want to: 1) terminate program 2) check & print one deadlock 3) check & print all deadlocks 4) dump thread stacks 5) dump lock registry 6) continue program Select Action: 6 --------- Continuing Program --------- ... |