thread dump how to trigger scn wiki

13
10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 1/13 Getting Started Newsletters Store Search the Community Welcome, Guest Login Register Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Added by Ina Ivanova, last edited by Tapan Goyal on Sep 24, 2013 Technology Troubleshooting Guide (JSTTSG)(Deploy)Thread Dump Overview You are using AS Java and w ant to create a thread dump from all Java threads running on a server process. This page describes how to perf orm a thread dump and how to locate the collected inf ormation. How can I generate thread dumps ? #Using the SAP Management Console #Using JCMon #On Unix #On Window s #On IBM i Without having console on Window s (Java 1.4 or 5) Using the SAP Management Console Step 1 Open SAP(M)MC. You have to create 3 consecutive thread dumps at a short interval of time (e.g. 5 seconds).

Upload: devisri522

Post on 01-Jan-2016

152 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 1/13

Getting Started Newsletters Store

Search the Community

Welcome, Guest Login Register

Products Services & Support About SCN Downloads

Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation

Added by Ina Ivanova, last edited by Tapan Goyal on Sep 24, 2013

Technology Troubleshooting Guide

(JSTTSG)(Deploy)Thread Dump

Overview

You are using AS Java and w ant 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.

How can I generate thread dumps ?#Using the SAP Management Console

#Using JCMon

#On Unix

#On Window s

#On IBM i

Without having console on Window s (Java 1.4 or 5)

Using the SAP Management Console

Step 1

Open SAP(M)MC.

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

Page 2: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 2/13

Step 2

Go to AS Java Process Table view .

Step 3

Right click on the server process for w hich you w ant 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

Step 1

Start the JCMon program w ith the profile of the instance.

The JCMon binary is located into one of the follow ing 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

Netw eaver Versions 6.40-7.0x

Step 2

Enter "20" to go to the "Local Administration Menu".

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

Page 3: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 3/13

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 w ith a "y" if the selected server process is correct.

Netw eaver 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 w ith a "y" if the selected server process is correct.

Using JSMon

Start the JSMon program w ith the profile of the instance.

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

The JSMon binary is located in the follow ing 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 w hich w ill create a full thread dump

> process view

2) Create full thread dump (on Netw eaver 7.11)

> process vmdump <idx>

On Netw eaver 720 and higher:

> process sdump <idx>

After completion, you w ill f ind the thread dump in the

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

Page 4: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 4/13

/usr/sap/<SID>/<Instance>/w ork/std_<node name>.out f ile

The thread dump could be found in the f ile system of the application

server under location /usr/sap/<SYS>/<INSTANCE>/w ork/dev_sever[0..n] or

std_server[0..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 f iles in the w ork folder. After you triggered the thread dump, sort the f iles in the w ork folder by date. Then open

the most recent ones and look for the w ords dump and thread.

In case the process is not AS Java but some SL tool like sl_auto, SAPInst or JSPM, please see this page .

Using NWA (NetWeaver Administrator)

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

Step 1

Open a brow ser and access NWA URL http://<AS Java Hostname>:<HTTP Port>/nw a

Step 2

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

Page 5: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 5/13

Step 3

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

Page 6: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 6/13

Step 4

A Thread Dump w ill be generated that can be dow nloaded and attached w ith CSS message for further analysis.

Page 7: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 7/13

Alternative procedures

On Unix

Step 1

Start the JCMon program w ith 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

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 w ith 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", w ith higher SP levels, they have job names "SDM",

"DISPATCHER", "SERVER0" etc. Substitute <name> in the follow ing lines accordingly.

Step 3

Press function key F11 tw ice 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

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

Page 8: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 8/13

To create the Java thread dump, enter command:

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

DMPJVM creates a spool f ile. In this spool f ile you can f ind 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 w ithout stopping a JVM.

Step 5

To look at the created spool f ile, enter command WRKSPLF. Use the function key F11 to collect the follow ing information: f ile number, job name and job number.

Step 6

Create a text f ile containg the needed Java thread dump information to make the information accessible also to users of other operation systems.

Unattach the f ile getJavaDumpFile.TXT from

SAPNote 710154

into a temporary directory on your Window s PC.

Rename the f ile to getJavaDumpFile.bat.

Run the batch f ile to get a f ile 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 (Window s 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 w ith their process IDs (PID). Executing jstack and providing a PID as the only argument yields a full thread dump of the respective process:

Perform the next steps on your Window s PC.

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]

Page 9: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 9/13

Without having console on Windows (Java 1.4 or 5)

1. Go to http://w w w .adaptj.com/main/dow nload

2. Clink "Launch" -> w ill see...

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>

Page 10: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 10/13

3. Process (drop dow n menu) -> Select -> <choose java process> OK (button)

4. Process (drop dow n 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).

Page 11: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 11/13

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"

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

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

Note

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

Page 12: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 12/13

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.

Page 13: Thread Dump How to Trigger SCN Wiki

10/18/13 (JSTTSG)(Deploy)Thread Dump - Technology Troubleshooting Guide - SCN Wiki

wiki.scn.sap.com/wiki/display/TechTSG/(JSTTSG)(Deploy)Thread+Dump 13/13

No labels

Follow SCN

Contact Us SAP Help Portal

Privacy Terms of Use Legal Disclosure Copyright