How to get thread dump for Sun Java System Application Server

The command to obtain thread dump is different for Windows and Unix systems. Here I try to explain the process of obtaining thread dump on SJS Application Server 8.x and 9.x. In future blogs, I'll discuss about some of the application server commands and Java tools which are useful for diagnosis, management, and monitoring.

When the application server freezes or hangs or becomes sluggish for no apparent reason, it is recommended to generate a thread dump. The Thread Dump is a snapshot of the threads and monitors in a Java1 Virtual Machine (JVM). Refer to Stack Trace Info for more information on stack trace and how to interpret it.

Following is the process to generate thread dump for Sun Java System Application Server on Windows and Unix platforms. The Unix platforms include Solaris, Linux, and Mac. I have not tested it on Mac, any volunteers welcome.

Windows:

  • start the server in native and verbose mode

    In Sun Java System Application Server 8.x the launcher is 'native' by default. In 9.x the default is non-native, for obtaining thread dump change this to native by updating /config/asenv.bat and changing the value for 'AS_NATIVE_LAUNCHER from 'false' to 'true'.

    AS_NATIVE_LAUNCHER="true"

    asadmin start-domain --verbose [domain_name]

  • Above command opens up blank-window in addition to the asadmin-window which you used for starting the domain above.

  • Enter the key sequence <ctrl><break> in blank-window which will out put the thread dump for application server instance in asadmin-window.

  • Scroll back in the window until you reach the beginning of the dump, which will contain the words Full thread dump: Select all the text from that point forward, for example,

    Full thread dump Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode):

    "Timer-5" daemon prio=10 tid=0x092d5720 nid=0x73 in Object.wait() [0x9b52f000..0x9b52fd38] at java.lang.Object.wait(Native Method) - waiting on <0xa2a4b978> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:509) - locked <0xa2a4b978> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462)

    "Timer-4" prio=10 tid=0x0925d418 nid=0x72 in Object.wait() [0x9b4ed000..0x9b4edab8] at java.lang.Object.wait(Native Method) - waiting on <0xa2a49570> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:509) - locked <0xa2a49570> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462)

  • Copy the selected text to the clipboard and paste the selection into a text file.

Unix,Linux,MacOS:

  • Unlike windows, thread dump can be obtained in either native or non-native mode on unix platforms.

    Start the server in verbose mode.

    asadmin start-domain --verbose [domain_name]

  • On UNIX platforms you can send a signal to a program by using the kill command. This is the quit signal, which is handled by the JVM. For example, on Solaris you can use the command kill -QUIT process_id, where process_id is the process number of your Java program.

    Process id for the application server instance can be obtained using OS specific commands like ps with appropriate options, for ex. ps -elf, etc.

    Issue the command kill -QUIT <pid> or kill -3 <pid> on 'C' shell which causes the the thread dump to be displayed in asadmin-window which was used to start the domain.

  • Scroll back in the window until you reach the beginning of the dump, which will contain the words Full thread dump: Select all the text from that point forward, for example,

    Full thread dump Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode):

    "Timer-5" daemon prio=10 tid=0x092d5720 nid=0x73 in Object.wait() [0x9b52f000..0x9b52fd38] at java.lang.Object.wait(Native Method) - waiting on <0xa2a4b978> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:509) - locked <0xa2a4b978> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462)

    "Timer-4" prio=10 tid=0x0925d418 nid=0x72 in Object.wait() [0x9b4ed000..0x9b4edab8] at java.lang.Object.wait(Native Method) - waiting on <0xa2a49570> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:509) - locked <0xa2a49570> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462)

  • Copy the selected text to the clipboard and paste the selection into a text file.
<script type="text/javascript" language="javascript"> var sc_project=1784377; var sc_invisible=1; var sc_partition=16; var sc_security="d0160235"; </script> <script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script>
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

msreddy

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today