Troubleshooting Guide Java Platform, Standard Edition

Java Platform, Standard Edition

Troubleshooting Guide

Release 13

F17440-01

September 2019

Java Platform, Standard Edition Troubleshooting Guide, Release 13

F17440-01

Copyright ? 1995, 2019, Oracle and/or its affiliates. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictions on

use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your

license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify,

license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means.

Reverse engineering, disassembly, or decompilation of this software, unless required by law for

interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If

you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on

behalf of the U.S. Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,

any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are

"commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agencyspecific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the

programs, including any operating system, integrated software, any programs installed on the hardware,

and/or documentation, shall be subject to license terms and license restrictions applicable to the programs.

No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications.

It is not developed or intended for use in any inherently dangerous applications, including applications that

may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you

shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its

safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this

software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of

their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are

used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron,

the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro

Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information about content, products,

and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly

disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise

set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be

responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,

products, or services, except as set forth in an applicable agreement between you and Oracle.

Contents

Preface

Audience

xi

Documentation Accessibility

xi

Related Documents

xi

Conventions

xi

Part I

1

General Java Troubleshooting

Prepare Java for Troubleshooting

Set Up Java for Troubleshooting

1-1

Enable Options and Flags for JVM Troubleshooting

1-1

Gather Relevant Data

1-3

Make a Java Application Easier to Debug

2

1-3

Diagnostic Tools

Diagnostic Tools Overview

2-1

Flight Recorder

2-2

About Flight Recordings

2-3

Produce a Flight Recording

2-4

Inspect a Flight Recording

2-5

The jcmd Utility

2-6

Useful Commands for the jcmd Utility

2-8

Troubleshoot with the jcmd Utility

2-9

Native Memory Tracking

2-9

Use NMT to Detect a Memory Leak

2-10

How to Monitor VM Internal Memory

2-10

NMT Memory Categories

2-15

JConsole

2-16

Troubleshoot with the JConsole Tool

2-16

Monitor Local and Remote Applications with JConsole

2-18

iii

The jdb Utility

Troubleshoot with the jdb Utility

The jinfo Utility

Troubleshooting with the jinfo Utility

The jmap Utility

2-19

2-20

2-21

2-22

Heap Configuration and Usage

2-22

Heap Histogram

2-23

Class Loader Statistics

2-25

The jps Utility

2-27

The jrunscript Utility

2-27

The jstack Utility

2-27

Troubleshoot with the jstack Utility

2-28

Stack Trace from a Core Dump

2-28

Mixed Stack

2-28

The jstat Utility

2-30

The visualgc Tool

2-32

Control+Break Handler

2-33

Thread Dump

2-33

Thread States for a Thread Dump

2-34

Detect Deadlocks

2-35

Heap Summary

2-35

Native Operating System Tools

2-36

Troubleshooting Tools Based on the Operating System

2-36

Probe Providers in Java HotSpot VM

2-37

Custom Diagnostic Tools

3

2-19

2-38

The java.lang.management Package

2-39

The java.lang.instrument Package

2-39

The java.lang.Thread Class

2-39

JVM Tool Interface

2-40

Java Platform Debugger Architecture

2-40

Postmortem Diagnostic Tools

2-40

Hung Processes Tools

2-41

Monitoring Tools

2-42

Other Tools, Options, Variables, and Properties

2-43

The jstatd Daemon

2-44

Troubleshoot Memory Leaks

Debug a Memory Leak Using Flight Recorder

3-1

Understand the OutOfMemoryError Exception

3-4

Troubleshoot a Crash Instead of OutOfMemoryError

3-7

iv

Diagnose Leaks in Java Language Code

Get a Heap Histogram

3-8

Monitor the Objects Pending Finalization

3-9

Diagnose Leaks in Native Code

4

Track All Memory Allocation and Free Calls

3-10

Track All Memory Allocations in the JNI Library

3-10

Track Memory Allocation with Operating System Support

3-11

Flight Recorder Overhead

4-1

Find Bottlenecks

4-2

Garbage Collection Performance

4-3

Synchronization Performance

4-4

I/O Performance

4-5

Code Execution Performance

4-5

Debug JVM Issues

Troubleshoot System Crashes

Determine Where the Crash Occurred

5-1

Crash the Native Code

5-2

Crash in the Compiled Code

5-3

Crash in the HotSpot Compiler Thread

5-4

Crash in the VM Thread

5-4

Crash Due to Stack Overflow

5-4

Find a Workaround

5-6

Working Around Crashes in the HotSpot Compiler Thread or Compiled Code

5-6

Working Around Crashes During Garbage Collection

5-8

Working Around Crashes Caused by Class Data Sharing

Microsoft Visual C++ Version Considerations

6

3-9

Troubleshoot Performance Issues Using Flight Recorder

Part II

5

3-7

5-10

5-10

Troubleshoot Process Hangs and Loops

Diagnose a Loop Process

6-1

Diagnose a Hung Process

6-2

Deadlock Detected

6-2

Deadlock Not Detected

6-4

No Thread Dump

6-4

v

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download