Downtime Announcement: Please note the SAP Community Wiki will be unavailable due to a system upgrade on Thursday, September 24th between 6 and 7 AM CEST
Skip to end of metadata
Go to start of metadata

Overview

You are using AS Java and want to create a thread dump from all Java threads running on a server process.
This page describes how to perform a thread dump and how to locate the collected information.

You have to create 3 consecutive thread dumps at a short interval of time (e.g. 5 seconds).

 

How can I generate thread dumps ?

#Using the SAP Management Console
#Using JCMon
#Using NWA (NetWeaver Administrator) 
#Using the XPI Inspector tool
#Using the NW Java Support Tool
#Using the SAP JVM Profiler
#On Unix
#On Windows
#On IBM i
Without having console on Windows (Java 1.4 or 5)

Using the SAP Management Console

Step 1
Open SAP(M)MC.

Step 2
Go to AS Java Process Table view.
Step 3
Right click on the server process for which you want to create a thread dump and select Dump Stack Trace.
If you are not sure which is the right server process, create thread dumps for all server processes.
Step 4
Wait for at least 5 seconds.
Step 5
Make another dump (until you have the 3 dumps).
In case you want to make dumps for all server processes, you should have 3*<number of nodes> dumps.

Using JCMon

The JCMon must be started with adm user in order to have the correct environment (for example LD_LIBRARY_PATH).

Step 1
Start the JCMon program with the profile of the instance.

The JCMon binary is located into one of the following directories:

  • /usr/sap/<SID>/<Instance>/j2ee/os_libs
  • /usr/sap/<SID>/SYS/exe/run directory.

Example: >jcmon.exe pf=C:\usr\sap\N71\SYS\profile\N71_JC02_sofd60135707

Netweaver Versions 6.40-7.0x

Step 2
Enter "20" to go to the "Local Administration Menu".
Step 3
Choose the "Dump stacktrace" menu item by entering its number.
Step 4
Select the server process from the list of processes above (the table just above the menu items) and enter the value from the "Idx" column.
Step 5
Confirm the command with a "y" if the selected server process is correct.

Netweaver Versions 7.10 and higher versions:

Step 2
Enter "30" to go to the "Solid Rock Administration Menu".
Step 3
Choose the "Dump call stacks" menu item by entering 10
Step 4
Select the server process from the list of processes above (the table just above the menu items) and enter the value from the "Idx" column.
Step 5
Confirm the command with a "y" if the selected server process is correct.

Using JSMon

Getting thread dump via JSMon tool is applicable to SAP NetWeaver 7.1 EHP1 and higher versions.

Start the JSMon program with the profile of the instance.

>jsmon pf=/usr/sap/<SID>/SYS/profile/<SID_Instance_NostName>

The JSMon binary is located in the following path:
/usr/sap/<SID>/<Instance>/exe
directory or in the:
/usr/sap/<SID>/SYS/exe/uc/<OS_Name>
directory.

In the started prompt please follow the steps:
Page 2

1) Get the index of the process which will create a full thread dump
> process view

2) Create full thread dump
> process vmdump <idx>
or
> process sdump <idx>

After completion, you will find the thread dump in the
/usr/sap/<SID>/<Instance>/work/std_<node name>.out file

The thread dump could be found in the file system of the application
server under location /usr/sap/<SYS>/<INSTANCE>/work/dev_sever[0..n] or
std_server[0..n].

Using NWA (NetWeaver Administrator)

Thread dumps can be captured through NWA for NW AS Java 7.3 and above systems

Step 1
Open a browser and access NWA URL http://<AS Java Hostname>:<HTTP Port>/nwa

Step 2

Navigate to Troubleshooting -> Advanced Troubleshooting -> Thread Dump Analysis

Step 3

Click Generate Thread Dump. Select an option that best suits to your situation. Press OK.

Step 4

A Thread Dump will be generated that can be downloaded and attached with CSS message for further analysis.

Using the XPI Inspector tool

  1. Access the XPI Inspector Tool using URL: http://<host>:<port>/xpi_inspector
  2. Select Example #51 (Performance Problem)
  3. Set the number of thread dumps to trigger and the interval

            

Using the NW Java Support Tool

See the detailed instructions and the download options for this tool: SAP NW Java Support Tool.

Using the SAP JVM Profiler

With the SAP JVM Profiler you can take multiple thread dumps automatically, just specifying how many dumps you want, and the frequency.

More details on the KBA 2376914.

Using the SAP JVM Eclipse plug-in, this information can be obtained. For more details, check SAP KBA ##2671374 - How to generate Thread dumps using SAP JVM Eclipse plug-in.
Screenshot:

Where are the generated thread dumps?

The location of the generated thread dump is JVM dependent:

  • For JVMs from SAP, SUN and HP - /usr/sap/<SID>/<Instance>/work/std <node name>.out'
  • For JVMs from IBM /usr/sap/<SID>/<Instance>/j2ee/cluster/serverX/javacore.<timestamp>.<PID>.txt

If you have problems locating the thread dump, it is a good idea to have a look at the various files in the work folder. After you triggered the thread dump, sort the files in the work folder by date. Then open the most recent ones and look for the words dump and thread.

Alternative procedures

On Unix

Step 1
Start the JCMon program with the profile of the instance.
Step 2
Enter "20" to go to the "Local Administration Menu".
Step 3
Note the process ID (PID) from the server process.
Step 4
Issue a "kill -3 <PID>" command from the shell.
Step 5
Find the generated thread dump (see the section above).

On Windows

This procedure is not applicable for double stack installations (R/3 and AS Java running in the same instance).

Step 1
Open the SAP Management Console.
Step 2
Navigate to the Process table of the Java instance.
Step 3
Right-click on the server process and from the context menu, choose "Dump Stack Trace".

On IBM i

Step 1
Log on as QSECOFR or a user with similar authorization.
Step 2
To check the Java processes in your subsystem, enter command WRKACTJOB SBSR3(<instance_number>).

Jobs labeled "PGM-JLAUNCH" in column "Function" are Java processes. In earlier support packages, those processes had the job name "JLAUNCH", with higher SP levels, they have job names "SDM", "DISPATCHER", "SERVER0" etc. Substitute <name> in the following lines accordingly.

Step 3
Press function key F11 twice to get the user und the process number of the JVMs (job name <name>). These values are needed to create a Java thread dump.
Step 4
To create the Java thread dump, enter command:

DMPJVM JOB(<process_number>/<job user>/<name>) STACKFRAME(*ALL)

DMPJVM creates a spool file. In this spool file you can find not only all Java threads dumps, but also the heap stack and the class loader information. DMPJVM does not stop a running JVM. This means that you can create a Java thread dump at any time without stopping a JVM.

Step 5
To look at the created spool file, enter command WRKSPLF. Use the function key F11 to collect the following information: file number, job name and job number.
Step 6
Create a text file containg the needed Java thread dump information to make the information accessible also to users of other operation systems.

Perform the next steps on your Windows PC.

 

  • Unattach the file getJavaDumpFile.TXT from
    SAPNote 710154
    into a temporary directory on your Windows PC.
  • Rename the file to getJavaDumpFile.bat.
  • Run the batch file to get a file called javadump.txt containing the Java thread dumps:
    getJavaDumpFile.bat <iSeries_hostname> <QSECOFR> <QSECOFR_password> <spoolfile_name> <file_number> <job_name> <job_number>
    Example: _getJavaDumpFile.bat as0096 QSECOFR secret QDMPJVM 2 QPADEV0004 QSECOFR 060594_

Using jstack

If you are running Sun/SAP Java EE 6 (Windows and Linux) or Java EE 5 (Linux only) you may use the jps and jstack tools to obtain a thread dump. Executing jps gives a list of all the Java processes on the current host, along with their process IDs (PID). Executing jstack and providing a PID as the only argument yields a full thread dump of the respective process:

C:\usr\sap\LKG\J92\exe\sapjvm_6\bin>jps
8844 Main
10220 Jps 
 
C:\usr\sap\LKG\J92\exe\sapjvm_6\bin>jstack 8844
2009-01-30 10:26:40
Full thread dump SAP Java Server VM (6.1.0851 Dec 16 2008 05:19:29 - cons - optU - windows x86 - 6 - bas2:113185 (mixed mode)):
"Low Memory Detector" daemon cpu=0.00 [reset 0.00] ms allocated=16272 B (15.89 kB) [reset 16272 B (15.89 kB)]
io= file i/o: 0/0 B, net i/o: 0/0 B, files opened:0, socks opened:0  [reset file i/o: 0/0 B, net i/o: 0/0 B, files opened:0, socks opened:0 ]
prio=6 tid=0x00a4b298  [_thread_blocked (_at_safepoint), stack(0x00e60000,0x00eb0000)] [0x00000000..0x00000000]
   java.lang.Thread.State: RUNNABLE
...............
prio=6 tid=0x00624400  [_thread_blocked (_at_safepoint), stack(0x00420000,0x00470000)] [0x0046f000..0x0046fe04]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(J)V(Native Method)
        at Main.main([Ljava/lang/String;)V(Main.java:13)
................ 
 
"VM Periodic Task Thread" cpu=0.00 [reset 0.00] ms
io= file i/o: 0/0 B, net i/o: 0/0 B, files opened:0, socks opened:0  [reset file i/o: 0/0 B, net i/o: 0/0 B, files opened:0, socks opened:0 ]
prio=10 tid=0x00a4caa8
JNI global references: 1105

C:\usr\sap\LKG\J92\exe\sapjvm_6\bin>

Without having console on Windows (Java 1.4 or 5)

  1. Go to http://www.adaptj.com/main/download
  2. Clink "Launch" -> will see...
  3. Process (drop down menu) -> Select -> <choose java process> OK (button)
  4. Process (drop down menu) -> Thread Dump
  5. Done

NOTE: This doesn't always work. If you are connected to the target system via terminal connection (i.e. mstsc - remote desktop) you might need to perform some additional steps. For more info see the tool documentation. If possilbe always use the standard tools that come with the JVM (jps and jstack)

How to read Thread Dump file(s)?

Open the thread dump file (read "Where are the generated thread dumps?" section if you are not able to locate the thread dump file).

For the given sample Notepad.exe is used.

1. Go to the bottom of the file the and perform search for "Full thread dump SAP Java Server"

Note

The search is performed from BOTTOM to TOP of the file in order to locate the last thread dump

2. Put the cursor in the beginning of the thread dump

3. Scroll the file until you reach the end of thread dump

4. Copy/paste the thread dump information into new file
5. Perform a search in the new file that contains only the thread dump for keywords you are looking for.

E.g. to locate and analyze the Deployment threads look for:

  • DeployThread
  • com.sap.engine.services.dc
  • com.sap.engine.services.deploy
6. For two or more thread dump files compare the called classes and at which row the class is called in order to determine if the process is still running or is hanging.

 

 

  • No labels