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
#On Unix
#On Windows
#On IBM i
#Without having console on Windows

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

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.

Using JSMon

Step 1

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 paths: /usr/sap/<SID>/<Instance>/exe or /usr/sap/<SID>/SYS/exe/uc/<OS_Name>.

In the started prompt please follow the steps:

Step 2

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

Step 3

Create full thread dump
> process vmdump <inx>

After completion, you will find the thread dump in file system of the application server under location /usr/sap/<SYS>/<INSTANCE>/work/dev_sever0..n or std_server0..n.

Using jvmmon (SAP JVM 1.5)

Step 1

Start the jvmmon program

> jvmmon

The JSMon binary is located in the following path:

/usr/sap/<SID>/<Instance>/exe/sapjvm_5/bin.

Step 2

Get the index of the virtual machine which will create a full thread dump
> display vms

Step 3

Create full thread dump
> dump stack trace <inx>

Step 4

Quit jvmmon
>q

After completion, you will find the thread dump in file system of the application server under location /usr/sap/<SYS>/<INSTANCE>/work/dev_sever0..n or std_server0..n.

Where are the generated thread dumps?

The location of the generated thread dump is JVM dependent:

  • For JVMs from SUN, SAP 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:

Without having console on Windows (Java 1.4 or 5)

  1. Clink "Launch" -> will see...
  2. Process (drop down menu) -> Select -> <choose java process> OK (button)
  3. Process (drop down menu) -> Thread Dump
  4. Done

NOTE: This doesn't alway 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)?

here

  • No labels