Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

IBM Developer Kit and Runtime Environment, Java Technology Edition, Version 5.0
PREMIUM
Số trang
468
Kích thước
4.4 MB
Định dạng
PDF
Lượt xem
1971

IBM Developer Kit and Runtime Environment, Java Technology Edition, Version 5.0

Nội dung xem thử

Mô tả chi tiết

IBM Developer Kit and Runtime Environment, Java Technology Edition, Version 5.0

Diagnostics Guide

Version 5 Release 0

SC34-6650-07



IBM Developer Kit and Runtime Environment, Java Technology Edition, Version 5.0

Diagnostics Guide

Version 5 Release 0

SC34-6650-07



Note

Before using this information and the product it supports, read the information in “Notices” on page 431.

Eighth Edition (March 2008)

This edition applies to all the platforms that are included in the IBM Developer Kit and Runtime Environment, Java

2 Technology Edition, Version 5.0 and to all subsequent releases and modifications until otherwise indicated in new

editions. Technical changes made for all the editions of this book are indicated by vertical bars to the left of the

changes.

© Copyright International Business Machines Corporation 2003, 2008. All rights reserved.

US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract

with IBM Corp.

Contents

Figures . . . . . . . . . . . . . . . ix

Tables . . . . . . . . . . . . . . . xi

About the Diagnostics Guide . . . . . xiii

What does the ″Java Virtual Machine (JVM)″ mean? xiii

Who should read this book . . . . . . . . . xiv

Using this book. . . . . . . . . . . . . xiv

Other sources of information . . . . . . . . xiv

Reporting problems in the JVM . . . . . . . xv

Conventions and terminology . . . . . . . . xv

How to send your comments . . . . . . . . xv

Contributors to this book . . . . . . . . . xvi

Summary of changes . . . . . . . . . . . xvi

For the eighth edition. . . . . . . . . . xvi

For the seventh edition . . . . . . . . . xvi

For the sixth edition . . . . . . . . . . xvi

For the fifth edition . . . . . . . . . . xvi

For the fourth edition . . . . . . . . . xvii

For the third edition . . . . . . . . . . xvii

For the second edition . . . . . . . . . xvii

For the first edition . . . . . . . . . . xvii

Part 1. Understanding the IBM SDK

for Java . . . . . . . . . . . . . . 1

Chapter 1. The building blocks of the

IBM Virtual Machine for Java. . . . . . 3

Java application stack . . . . . . . . . . . 4

Components of the IBM Virtual Machine for Java . . 4

JVM API. . . . . . . . . . . . . . . 5

Diagnostics component . . . . . . . . . . 5

Memory management . . . . . . . . . . 5

Class loader . . . . . . . . . . . . . 6

Interpreter . . . . . . . . . . . . . . 6

Platform port layer . . . . . . . . . . . 6

Chapter 2. Memory management . . . . 7

Overview of memory management . . . . . . . 7

Object allocation . . . . . . . . . . . . 7

Reachable objects . . . . . . . . . . . . 8

Garbage collection . . . . . . . . . . . 8

Heap sizing problems . . . . . . . . . . 8

Allocation . . . . . . . . . . . . . . . 9

Heap lock allocation . . . . . . . . . . . 9

Cache allocation . . . . . . . . . . . . 9

Large Object Area . . . . . . . . . . . 10

Detailed description of garbage collection . . . . 11

Mark phase . . . . . . . . . . . . . 11

Sweep phase . . . . . . . . . . . . . 13

Compaction phase . . . . . . . . . . . 15

Subpool (AIX, Linux PPC and zSeries, z/OS and

i5/OS only) . . . . . . . . . . . . . 15

Reference objects . . . . . . . . . . . 16

Final reference processing . . . . . . . . 17

JNI weak reference . . . . . . . . . . . 17

Heap expansion . . . . . . . . . . . . 17

Heap shrinkage . . . . . . . . . . . . 18

Generational Concurrent Garbage Collector. . . . 19

Tenure age. . . . . . . . . . . . . . 20

Tilt ratio . . . . . . . . . . . . . . 20

How to do heap sizing . . . . . . . . . . 20

Initial and maximum heap sizes . . . . . . 20

Using verbose:gc . . . . . . . . . . . 21

Using fine tuning options. . . . . . . . . 21

Interaction of the Garbage Collector with

applications . . . . . . . . . . . . . . 22

How to coexist with the Garbage Collector . . . . 22

Root set . . . . . . . . . . . . . . 23

Thread local heap . . . . . . . . . . . 23

Bug reports . . . . . . . . . . . . . 23

Finalizers . . . . . . . . . . . . . . 23

Manual invocation . . . . . . . . . . . 25

Summary . . . . . . . . . . . . . . 25

Frequently asked questions about the Garbage

Collector . . . . . . . . . . . . . . . 26

Chapter 3. Class loading . . . . . . . 29

The parent-delegation model . . . . . . . . 29

Name spaces and the runtime package . . . . . 30

Custom class loaders . . . . . . . . . . . 31

Chapter 4. Class data sharing . . . . . 33

Chapter 5. The JIT compiler. . . . . . 35

JIT compiler overview . . . . . . . . . . . 35

How the JIT compiler optimizes code. . . . . . 36

Phase 1 - inlining . . . . . . . . . . . 36

Phase 2 - local optimizations . . . . . . . 36

Phase 3 - control flow optimizations . . . . . 37

Phase 4 - global optimizations . . . . . . . 37

Phase 5 - native code generation . . . . . . 37

Frequently asked questions about the JIT compliler 37

Chapter 6. Java Remote Method

Invocation . . . . . . . . . . . . . 39

The RMI implementation . . . . . . . . . . 39

Thread pooling for RMI connection handlers . . . 40

Understanding distributed garbage collection (DGC) 40

Debugging applications involving RMI . . . . . 41

Chapter 7. The ORB . . . . . . . . . 43

CORBA. . . . . . . . . . . . . . . . 43

RMI and RMI-IIOP . . . . . . . . . . . . 43

Java IDL or RMI-IIOP? . . . . . . . . . . 44

RMI-IIOP limitations . . . . . . . . . . . 44

Further reading . . . . . . . . . . . . . 44

© Copyright IBM Corp. 2003, 2008 iii

Examples of client–server applications . . . . . 45

Interfaces . . . . . . . . . . . . . . 45

Remote object implementation (or servant) . . . 45

Stubs and ties generation . . . . . . . . . 46

Server code . . . . . . . . . . . . . 46

Summary of major differences between RMI

(JRMP) and RMI-IIOP . . . . . . . . . . 49

Using the ORB . . . . . . . . . . . . . 50

How the ORB works . . . . . . . . . . . 54

The client side . . . . . . . . . . . . 54

The server side . . . . . . . . . . . . 58

Additional features of the ORB . . . . . . . . 60

Portable object adapter . . . . . . . . . 60

Fragmentation . . . . . . . . . . . . 62

Portable interceptors . . . . . . . . . . 63

Interoperable Naming Service (INS) . . . . . 65

Chapter 8. The Java Native Interface

(JNI) . . . . . . . . . . . . . . . . 67

Overview of JNI. . . . . . . . . . . . . 67

The JNI and the Garbage Collector . . . . . . 68

Overview of JNI object references . . . . . . 68

JNI transitions . . . . . . . . . . . . 71

Copying and pinning . . . . . . . . . . . 72

Using the isCopy flag . . . . . . . . . . 73

Using the mode flag . . . . . . . . . . 73

A generic way to use the isCopy and mode flags 74

Handling exceptions . . . . . . . . . . . 74

Synchronization . . . . . . . . . . . . . 74

Debugging the JNI . . . . . . . . . . . . 75

JNI checklist . . . . . . . . . . . . . . 77

Part 2. Submitting problem reports 79

Chapter 9. Overview of problem

submission. . . . . . . . . . . . . 81

How does IBM service Java?. . . . . . . . . 81

Submitting Java problem reports to IBM. . . . . 81

What goes into a problem report? . . . . . . 82

Problem severity ratings . . . . . . . . . . 82

Escalating problem severity . . . . . . . . . 82

Java duty manager . . . . . . . . . . . . 83

Chapter 10. MustGather: collecting the

correct data to solve problems . . . . 85

Before you submit a problem report . . . . . . 85

Data to include . . . . . . . . . . . . . 85

Things to try . . . . . . . . . . . . . . 86

Test cases . . . . . . . . . . . . . . . 86

Performance problems . . . . . . . . . . . 87

Factors that affect JVM performance . . . . . 87

Questions to ask about performance problems . . 87

Chapter 11. Submitting data with a

problem report . . . . . . . . . . . 89

Sending files to IBM Service . . . . . . . . . 89

Obtaining files from IBM Service . . . . . . . 90

Using your own ftp server . . . . . . . . . 91

Compressing files . . . . . . . . . . . . 91

How you receive your fix . . . . . . . . . 91

Part 3. Problem determination . . . 93

Chapter 12. First steps in problem

determination . . . . . . . . . . . . 95

Chapter 13. AIX problem determination 97

Setting up and checking your AIX environment . . 97

Enabling full AIX core files . . . . . . . . 98

General debugging techniques . . . . . . . . 99

AIX debugging commands . . . . . . . . 99

DBX Plug-in. . . . . . . . . . . . . 109

Diagnosing crashes . . . . . . . . . . . 110

Documents to gather . . . . . . . . . . 110

Locating the point of failure . . . . . . . 110

Debugging hangs . . . . . . . . . . . . 111

AIX deadlocks . . . . . . . . . . . . 112

AIX busy hangs . . . . . . . . . . . 112

Poor performance on AIX . . . . . . . . 114

Understanding memory usage . . . . . . . . 114

32- and 64-bit JVMs . . . . . . . . . . 114

The 32-bit AIX Virtual Memory Model . . . . 115

The 64-bit AIX Virtual Memory Model . . . . 116

Changing the Memory Model (32-bit JVM) . . 116

The native and Java heaps . . . . . . . . 117

The AIX 32-bit JVM default memory models . . 117

Monitoring the native heap. . . . . . . . 117

Native heap usage. . . . . . . . . . . 118

Specifying MALLOCTYPE . . . . . . . . 119

Monitoring the Java heap . . . . . . . . 119

Receiving OutOfMemoryError exceptions . . . 120

Is the Java or native heap exhausted? . . . . 120

Java heap exhaustion . . . . . . . . . . 120

Native heap exhaustion . . . . . . . . . 121

AIX fragmentation problems . . . . . . . 121

Submitting a bug report . . . . . . . . . 122

Debugging performance problems . . . . . . 122

Finding the bottleneck . . . . . . . . . 122

CPU bottlenecks . . . . . . . . . . . 123

Memory bottlenecks . . . . . . . . . . 127

I/O bottlenecks. . . . . . . . . . . . 127

JVM heap sizing . . . . . . . . . . . 128

JIT compilation and performance . . . . . . 128

Application profiling . . . . . . . . . . 128

MustGather information for AIX . . . . . . . 128

Chapter 14. Linux problem

determination . . . . . . . . . . . 131

Setting up and checking your Linux environment 131

General debugging techniques. . . . . . . . 133

Using the dump extractor . . . . . . . . 133

Using system dump tools . . . . . . . . 134

Examining process information . . . . . . 134

ldd . . . . . . . . . . . . . . . . 136

Tracing tools . . . . . . . . . . . . 136

Debugging with gdb . . . . . . . . . . 137

Diagnosing crashes . . . . . . . . . . . 139

Debugging hangs . . . . . . . . . . . . 140

iv IBM SDK for Java: Diagnostics Guide

Debugging memory leaks . . . . . . . . . 140

Debugging performance problems . . . . . . 141

Finding the bottleneck . . . . . . . . . 141

CPU usage . . . . . . . . . . . . . 141

Memory usage . . . . . . . . . . . . 142

Network problems . . . . . . . . . . 142

JVM heap sizing . . . . . . . . . . . 143

JIT compilation and performance . . . . . . 143

Application profiling . . . . . . . . . . 143

MustGather information for Linux . . . . . . 143

Known limitations on Linux . . . . . . . . 146

Chapter 15. Windows problem

determination . . . . . . . . . . . 149

Setting up and checking your Windows

environment. . . . . . . . . . . . . . 149

Windows 32-bit large address aware support 150

General debugging techniques. . . . . . . . 151

Using the Cross-Platform Dump Viewer . . . 151

System dump . . . . . . . . . . . . 151

Diagnosing crashes in Windows . . . . . . . 152

Data to send to IBM . . . . . . . . . . 152

Debugging hangs . . . . . . . . . . . . 153

Getting a dump from a hung JVM . . . . . 153

Analyzing deadlocks . . . . . . . . . . 153

Debugging memory leaks . . . . . . . . . 153

The Windows memory model . . . . . . . 154

Classifying leaks . . . . . . . . . . . 154

Tracing leaks . . . . . . . . . . . . 154

Using Heapdump to debug memory leaks. . . 155

OutOfMemoryError creating a thread . . . . . 155

Debugging performance problems . . . . . . 155

Finding the bottleneck . . . . . . . . . 156

Windows systems resource usage. . . . . . 156

JVM heap sizing . . . . . . . . . . . 156

JIT compilation and performance . . . . . . 156

Application profiling . . . . . . . . . . 156

MustGather information for Windows . . . . . 157

Chapter 16. z/OS problem

determination . . . . . . . . . . . 159

Setting up and checking your z/OS environment 159

Maintenance. . . . . . . . . . . . . 159

LE settings . . . . . . . . . . . . . 159

Environment variables . . . . . . . . . 159

Private storage usage . . . . . . . . . . 159

Setting up dumps . . . . . . . . . . . 160

General debugging techniques. . . . . . . . 160

Using IPCS commands . . . . . . . . . 161

Using dbx . . . . . . . . . . . . . 161

Interpreting error message IDs . . . . . . 162

Diagnosing crashes . . . . . . . . . . . 162

Documents to gather . . . . . . . . . . 162

Determining the failing function . . . . . . 163

Working with TDUMPs using IPCS . . . . . 165

Debugging hangs . . . . . . . . . . . . 169

The process is deadlocked . . . . . . . . 169

The process is looping . . . . . . . . . 169

The process is performing badly . . . . . . 170

Debugging memory leaks . . . . . . . . . 170

Allocations to LE HEAP . . . . . . . . . 170

z/OS virtual storage . . . . . . . . . . 171

OutOfMemoryError exceptions . . . . . . 171

Debugging performance problems . . . . . . 172

Finding the bottleneck . . . . . . . . . 172

z/OS systems resource usage . . . . . . . 173

JVM heap sizing . . . . . . . . . . . 173

JIT compilation and performance . . . . . . 173

Application profiling . . . . . . . . . . 173

MustGather information for z/OS . . . . . . 173

Chapter 17. i5/OS problem

determination . . . . . . . . . . . 175

Determining which VM is in use . . . . . . . 175

Setting up your IBM Technology for Java

Environment . . . . . . . . . . . . . 175

Required Software and Licensing . . . . . . 175

Configuring JAVA_HOME . . . . . . . . 176

Enabling i5/OS PASE core files . . . . . . 177

Setting environment variables for i5/OS PASE

or QShell . . . . . . . . . . . . . . 178

Determining a user’s home directory . . . . 179

Setting default Java command-line options . . 179

General debugging techniques. . . . . . . . 181

Diagnosing problems at the command line . . 181

i5/OS debugging commands . . . . . . . 182

Debugging performance problems . . . . . . 183

Analyzing CPU bottlenecks. . . . . . . . 183

Analyzing memory problems . . . . . . . 185

Analyzing I/O problems . . . . . . . . 186

Diagnosing crashes . . . . . . . . . . . 190

Checking the system environment . . . . . 190

Finding out about the Java environment . . . 190

Detailed crash diagnosis. . . . . . . . . 190

Diagnosing hangs . . . . . . . . . . . . 190

i5/OS deadlocks . . . . . . . . . . . 190

i5/OS busy hangs . . . . . . . . . . . 191

Understanding memory usage. . . . . . . . 191

The 32-bit i5/OS PASE Virtual memory model 191

The process and garbage-collected heaps . . . 192

Monitoring the garbage-collected heap . . . . 192

Process heap usage . . . . . . . . . . 192

OutOfMemoryError exceptions . . . . . . 193

Garbage-collected heap exhaustion . . . . . 193

Submitting a bug report . . . . . . . . . 193

Using dbx . . . . . . . . . . . . . . 194

Using the DBX Plug-in for Java . . . . . . 194

Important dbx usage notes and warnings . . . 195

Using dbx to investigate a Java system dump 195

Starting dbx on a system dump

(core.{date}.{time}.{pid}.dmp) . . . . . . . 196

Chapter 18. Sun Solaris problem

determination . . . . . . . . . . . 197

Chapter 19. Hewlett-Packard SDK

problem determination . . . . . . . 199

Contents v

|

Chapter 20. ORB problem

determination . . . . . . . . . . . 201

Identifying an ORB problem . . . . . . . . 201

Debug properties . . . . . . . . . . . . 202

ORB exceptions . . . . . . . . . . . . 203

Completion status and minor codes . . . . . . 204

Java security permissions for the ORB . . . . . 205

Interpreting the stack trace . . . . . . . . . 206

Description string . . . . . . . . . . . 207

Interpreting ORB traces . . . . . . . . . . 207

Message trace . . . . . . . . . . . . 207

Comm traces . . . . . . . . . . . . 208

Client or server. . . . . . . . . . . . 209

Service contexts . . . . . . . . . . . 210

Common problems . . . . . . . . . . . 210

ORB application hangs . . . . . . . . . 210

Running the client without the server running

before the client is invoked . . . . . . . . 211

Client and server are running, but not naming

service. . . . . . . . . . . . . . . 212

Running the client with MACHINE2 (client)

unplugged from the network . . . . . . . 212

IBM ORB service: collecting data . . . . . . . 213

Preliminary tests . . . . . . . . . . . 213

Chapter 21. NLS problem

determination . . . . . . . . . . . 215

Overview of fonts . . . . . . . . . . . . 215

Font utilities. . . . . . . . . . . . . . 216

Common NSL problem and possible causes . . . 216

Part 4. Using diagnostic tools . . . 219

Chapter 22. Overview of the available

diagnostics . . . . . . . . . . . . 221

Categorizing the problem . . . . . . . . . 221

Summary of diagnostic information . . . . . . 221

Summary of cross-platform tooling . . . . . . 223

Heapdump analysis tooling . . . . . . . 223

Cross-platform dump viewer . . . . . . . 223

JVMTI tools . . . . . . . . . . . . . 223

JVMPI tools . . . . . . . . . . . . . 224

JPDA tools . . . . . . . . . . . . . 224

DTFJ . . . . . . . . . . . . . . . 224

Trace formatting . . . . . . . . . . . 224

JVMRI. . . . . . . . . . . . . . . 225

Chapter 23. Using dump agents . . . 227

Using the -Xdump option . . . . . . . . . 227

Dump agents . . . . . . . . . . . . . 228

Console dumps. . . . . . . . . . . . 229

System dumps . . . . . . . . . . . . 229

Tool option . . . . . . . . . . . . . 230

Javadumps . . . . . . . . . . . . . 230

Heapdumps . . . . . . . . . . . . . 230

Snap traces . . . . . . . . . . . . . 231

Dump events . . . . . . . . . . . . . 231

Advanced control of dump agents . . . . . . 232

exec option . . . . . . . . . . . . . 232

file option . . . . . . . . . . . . . 232

filter option . . . . . . . . . . . . . 233

opts option . . . . . . . . . . . . . 233

priority option . . . . . . . . . . . . 234

range option. . . . . . . . . . . . . 234

request option . . . . . . . . . . . . 234

defaults option . . . . . . . . . . . . 235

Dump agent tokens . . . . . . . . . . . 235

Default dump agents . . . . . . . . . . . 236

Removing dump agents . . . . . . . . . . 237

Dump agent environment variables . . . . . . 237

Platform-specific variations . . . . . . . . . 238

Windows, Linux, AIX, and i5/OS. . . . . . 239

z/OS . . . . . . . . . . . . . . . 239

Chapter 24. Using Javadump. . . . . 241

Enabling a Javadump. . . . . . . . . . . 241

Triggering a Javadump . . . . . . . . . . 241

Interpreting a Javadump . . . . . . . . . 242

Javadump tags . . . . . . . . . . . . 242

TITLE, GPINFO, and ENVINFO sections . . . 243

Storage Management (MEMINFO) . . . . . 245

Locks, monitors, and deadlocks (LOCKS) . . . 246

Threads and stack trace (THREADS) . . . . 247

Classloaders and Classes (CLASSES) . . . . 248

Environment variables and Javadump . . . . . 249

Chapter 25. Using Heapdump . . . . 251

Information for users of previous releases of

Heapdump . . . . . . . . . . . . . . 251

Getting Heapdumps . . . . . . . . . . . 251

Enabling text formatted (″classic″) Heapdumps 252

Available tools for processing Heapdumps . . . 252

Using -Xverbose:gc to obtain heap information . . 252

Environment variables and Heapdump. . . . . 252

Text (classic) Heapdump file format . . . . . . 253

Chapter 26. Using system dumps and

the dump viewer . . . . . . . . . . 257

Overview of system dumps . . . . . . . . 257

System dump defaults . . . . . . . . . . 258

Overview of the dump viewer. . . . . . . . 258

Using the dump extractor, jextract . . . . . 258

Using the dump viewer, jdmpview . . . . . 259

Dump viewer commands . . . . . . . . . 260

General commands . . . . . . . . . . 260

Working with locks . . . . . . . . . . 262

Showing details of a dump . . . . . . . . 263

Analysing the memory . . . . . . . . . 263

Working with classes . . . . . . . . . . 264

Working with objects . . . . . . . . . . 265

Generating Heapdumps . . . . . . . . . 265

Working with trace . . . . . . . . . . 266

Example session . . . . . . . . . . . . 266

Chapter 27. Tracing Java applications

and the JVM . . . . . . . . . . . . 277

What can be traced? . . . . . . . . . . . 277

Default tracing . . . . . . . . . . . . . 278

Where does the data go? . . . . . . . . . 279

vi IBM SDK for Java: Diagnostics Guide

Writing trace data to memory buffers . . . . 279

Writing trace data to a file . . . . . . . . 280

External tracing . . . . . . . . . . . 280

Tracing to stderr . . . . . . . . . . . 281

Trace combinations . . . . . . . . . . 281

Controlling the trace . . . . . . . . . . . 281

Specifying trace options . . . . . . . . . 281

Detailed descriptions of trace options . . . . 282

Using the Java API . . . . . . . . . . 295

Using the trace formatter . . . . . . . . . 295

Determining the tracepoint ID of a tracepoint . . 296

Application trace . . . . . . . . . . . . 297

Implementing application trace . . . . . . 297

Using application trace at runtime . . . . . 299

Using method trace . . . . . . . . . . . 300

Running with method trace . . . . . . . 300

Examples of use . . . . . . . . . . . 301

Example of method trace . . . . . . . . 302

Chapter 28. JIT problem determination 305

Diagnosing a JIT problem . . . . . . . . . 305

Disabling the JIT compiler . . . . . . . . 305

Selectively disabling the JIT compiler . . . . 306

Locating the failing method . . . . . . . 307

Identifying JIT compilation failures . . . . . 308

Performance of short-running applications . . . 309

JVM behavior during idle periods . . . . . . 309

Chapter 29. Garbage Collector

diagnostics . . . . . . . . . . . . 311

How do the garbage collectors work? . . . . . 311

Common causes of perceived leaks . . . . . . 311

Listeners . . . . . . . . . . . . . . 311

Hash tables . . . . . . . . . . . . . 312

Static class data . . . . . . . . . . . 312

JNI references . . . . . . . . . . . . 312

Objects with finalizers . . . . . . . . . 312

-verbose:gc logging . . . . . . . . . . . 312

Global collections . . . . . . . . . . . 313

Garbage collection triggered by System.gc() . . 314

Allocation failures . . . . . . . . . . . 315

Scavenger collections . . . . . . . . . . 316

Concurrent garbage collection . . . . . . . 317

Timing problems during garbage collection . . 321

-Xtgc tracing . . . . . . . . . . . . . 322

-Xtgc:backtrace . . . . . . . . . . . . 322

-Xtgc:compaction . . . . . . . . . . . 323

-Xtgc:concurrent . . . . . . . . . . . 323

-Xtgc:dump . . . . . . . . . . . . . 323

-Xtgc:excessiveGC . . . . . . . . . . . 324

-Xtgc:freelist . . . . . . . . . . . . . 324

-Xtgc:parallel . . . . . . . . . . . . 325

-Xtgc:references. . . . . . . . . . . . 325

-Xtgc:scavenger. . . . . . . . . . . . 325

-Xtgc:terse . . . . . . . . . . . . . 326

Chapter 30. Class-loader diagnostics 327

Class-loader command-line options . . . . . . 327

Class-loader runtime diagnostics . . . . . . . 327

Loading from native code . . . . . . . . . 328

Chapter 31. Shared classes

diagnostics . . . . . . . . . . . . 331

Deploying Shared Classes . . . . . . . . . 331

Cache naming . . . . . . . . . . . . 331

Cache access . . . . . . . . . . . . 332

Cache housekeeping . . . . . . . . . . 332

Cache performance . . . . . . . . . . 333

Compatibility between service releases . . . . 334

Dealing with runtime bytecode modification . . . 335

Potential problems with runtime bytecode

modification. . . . . . . . . . . . . 335

Modification contexts. . . . . . . . . . 336

SharedClassHelper partitions . . . . . . . 336

Using the safemode option . . . . . . . . 336

Further considerations for runtime bytecode

modification. . . . . . . . . . . . . 337

Understanding dynamic updates . . . . . . . 337

Using the Java Helper API . . . . . . . . . 339

SharedClassHelper api . . . . . . . . . 341

Understanding shared classes diagnostics output 341

Verbose output . . . . . . . . . . . . 342

VerboseIO output . . . . . . . . . . . 342

VerboseHelper output . . . . . . . . . 342

printStats utility . . . . . . . . . . . 343

printAllStats utility . . . . . . . . . . 344

Debugging problems with shared classes . . . . 345

Using shared classes trace . . . . . . . . 345

Why classes in the cache might not be found or

stored . . . . . . . . . . . . . . . 345

Dealing with initialization problems . . . . . 346

Dealing with verification problems . . . . . 348

Dealing with cache problems . . . . . . . 348

Class sharing with OSGi ClassLoading framework 348

Chapter 32. Using the Reliability,

Availability, and Serviceability

Interface . . . . . . . . . . . . . 349

Preparing to use JVMRI . . . . . . . . . . 349

Writing an agent . . . . . . . . . . . 349

Registering a trace listener . . . . . . . . 350

Changing trace options . . . . . . . . . 351

Launching the agent . . . . . . . . . . 351

Building the agent. . . . . . . . . . . 352

Agent design . . . . . . . . . . . . 352

JVMRI functions . . . . . . . . . . . . 352

API calls provided by JVMRI . . . . . . . . 353

CreateThread . . . . . . . . . . . . 353

DumpDeregister . . . . . . . . . . . 353

DumpRegister . . . . . . . . . . . . 353

DynamicVerbosegc . . . . . . . . . . 354

GenerateHeapdump . . . . . . . . . . 354

GenerateJavacore . . . . . . . . . . . 354

GetComponentDataArea. . . . . . . . . 354

GetRasInfo . . . . . . . . . . . . . 355

InitiateSystemDump . . . . . . . . . . 355

InjectOutOfMemory . . . . . . . . . . 355

InjectSigSegv . . . . . . . . . . . . 355

NotifySignal. . . . . . . . . . . . . 356

ReleaseRasInfo . . . . . . . . . . . . 356

RunDumpRoutine . . . . . . . . . . . 356

Contents vii

SetOutOfMemoryHook . . . . . . . . . 357

TraceDeregister. . . . . . . . . . . . 357

TraceDeregister50 . . . . . . . . . . . 357

TraceRegister . . . . . . . . . . . . 357

TraceRegister50 . . . . . . . . . . . . 358

TraceResume . . . . . . . . . . . . 358

TraceResumeThis . . . . . . . . . . . 358

TraceSet . . . . . . . . . . . . . . 359

TraceSnap . . . . . . . . . . . . . 359

TraceSuspend . . . . . . . . . . . . 359

TraceSuspendThis . . . . . . . . . . . 359

RasInfo structure . . . . . . . . . . . . 360

RasInfo request types. . . . . . . . . . . 360

Intercepting trace data . . . . . . . . . . 360

The -Xtrace:external=<option>. . . . . . . 360

Calling external trace . . . . . . . . . . 361

Formatting . . . . . . . . . . . . . . 361

Chapter 33. Using the HPROF Profiler 363

Explanation of the HPROF output file . . . . . 364

Chapter 34. Using the JVMTI . . . . . 369

Chapter 35. Using the Diagnostic Tool

Framework for Java . . . . . . . . 371

Using the DTFJ interface . . . . . . . . . 371

DTFJ example application . . . . . . . . . 375

Chapter 36. Using JConsole . . . . . 379

Part 5. Appendixes . . . . . . . . 383

Appendix A. CORBA minor codes . . 385

Appendix B. Environment variables 387

Displaying the current environment . . . . . . 387

Setting an environment variable . . . . . . . 387

Separating values in a list . . . . . . . . . 388

JVM environment settings . . . . . . . . . 388

z/OS environment variables . . . . . . . . 392

Appendix C. Messages . . . . . . . 393

DUMP messages . . . . . . . . . . . . 393

J9VM messages. . . . . . . . . . . . . 395

SHRC messages . . . . . . . . . . . . 397

Appendix D. Command-line options 411

Specifying command-line options. . . . . . . 411

General command-line options . . . . . . . 412

System property command-line options . . . . 413

Nonstandard command-line options . . . . . . 415

JIT command-line options . . . . . . . . . 420

Garbage Collector command-line options . . . . 421

Appendix E. Default settings for the

JVM . . . . . . . . . . . . . . . 429

Notices . . . . . . . . . . . . . . 431

Trademarks . . . . . . . . . . . . . . 432

Index . . . . . . . . . . . . . . . 435

viii IBM SDK for Java: Diagnostics Guide

Figures

1. The components of a typical Java Application

Stack and the IBM JRE . . . . . . . . . 4

2. . . . . . . . . . . . . . . . . . 5

3. New and old area in the generational

concurrent heap . . . . . . . . . . . 19

4. Example of heap layout before and after

garbage collection for gencon . . . . . . 19

5. Tilt ratio . . . . . . . . . . . . . 20

6. Illustration of RMI implementations . . . . 39

7. The ORB client side . . . . . . . . . . 54

8. Relationship between the ORB, the object

adapter, the skeleton, and the object

implementation . . . . . . . . . . . 61

9. Sample portable object adapter architecture 62

10. An example stack for a JNI application 71

11. The AIX 32–Bit Memory Model with

MAXDATA=0 (default) . . . . . . . . 115

12. Screenshot of the ReportEnv tool . . . . . 150

13. Diagram of the DTFJ interface . . . . . . 374

© Copyright IBM Corp. 2003, 2008 ix

x IBM SDK for Java: Diagnostics Guide

Tables

1. Commands for stubs and ties (skeletons) 46

2. Stub and tie files . . . . . . . . . . . 46

3. Deprecated Sun properties . . . . . . . 53

4. JNI checklist . . . . . . . . . . . . 77

5. . . . . . . . . . . . . . . . . 99

6. . . . . . . . . . . . . . . . . 133

7. . . . . . . . . . . . . . . . . 151

8. . . . . . . . . . . . . . . . . 160

9. Required fixes . . . . . . . . . . . 176

10. . . . . . . . . . . . . . . . . 181

11. Methods affected when running with Java 2

SecurityManager . . . . . . . . . . 205

12. Usage and configuration information for

dumps. . . . . . . . . . . . . . 228

13. Dump agents . . . . . . . . . . . 229

14. Events available as dump agent triggers 232

15. Dump agent request options . . . . . . 235

16. Available dump agent tokens . . . . . . 235

17. Signal mappings on different platforms 238

18. Environment variables used to produce

Javadumps . . . . . . . . . . . . 249

19. Environment variables used to produce heap

dumps . . . . . . . . . . . . . . 253

20. Java VM type signatures . . . . . . . . 255

21. Cross platform defaults . . . . . . . . 429

22. Platform-specific defaults . . . . . . . 430

© Copyright IBM Corp. 2003, 2008 xi

xii IBM SDK for Java: Diagnostics Guide

About the Diagnostics Guide

The Diagnostics Guide tells you about how the IBM® Virtual Machine for Java™

works, debugging techniques, and the diagnostic tools that are available to help

you solve problems with JVMs. It also gives guidance on how to submit problems

to IBM.

What does the ″Java Virtual Machine (JVM)″ mean?

The Java Virtual machine (JVM) is the application that executes a Java program

and it is included in the Java package.

The installable Java package supplied by IBM comes in two versions on Linux®

and Windows® platforms:

v The Java Runtime Environment (JRE)

v The Java Software Development Kit (SDK)

The AIX®, z/OS®, and i5/OS® platforms ship only the SDK.

The JRE provides runtime support for Java applications. The SDK provides the

Java compiler and other development tools. The SDK includes the JRE.

The JRE (and, therefore, the SDK) includes a JVM. This is the application that

executes a Java program. A Java program requires a JVM to run on a particular

platform, such as Linux™, z/OS®, or Windows®.

The IBM SDK, Version 5.0 contains a different implementation of the JVM and the

Just-In-Time compiler (JIT) from most earlier releases of the IBM SDK, apart from

the version 1.4.2 implementation on z/OS 64-bit and on AMD64/EM64T platforms.

You can identify this implementation in the output from the java -version

command, which gives these strings for the different implementations:

Implementation Output

5.0 IBM J9 VM (build 2.3, J2RE 1.5.0 IBM...

6 IBM J9 VM (build 2.4, J2RE 1.6.0 IBM...

1.4.2 ’classic’ Classic VM (build 1.4.2, J2RE 1.4.2 IBM...

1.4.2 on z/OS 64-bit and

AMD64/EM64T platforms

IBM J9SE VM (build 2.2, J2RE 1.4.2 IBM...

i5/OS ’classic’ 1.3.1 java version "1.3.1"

Java(TM) 2 Runtime Environment, Standard Edition (build ...)

Classic VM (build 1.3, build JDK-1.3, native threads, jitc_de)

i5/OS ’classic’ 1.4.2 java version "1.4.2"

Java(TM) 2 Runtime Environment, Standard Edition (build ...)

Classic VM (build 1.4, build JDK-1.4, native threads, jitc_de)

i5/OS ’classic’ 1.5.0 java version "1.5.0"

Java(TM) 2 Runtime Environment, Standard Edition (build ...)

Classic VM (build 1.5, build JDK-1.5, native threads, jitc_de)

i5/OS ’classic’ 1.6.0 java version "1.6.0"

Java(TM) SE Runtime Environment (build ...)

Classic VM (build 1.6, build JDK-1.6, native threads, jitc_de)

© Copyright IBM Corp. 2003, 2008 xiii

Tải ngay đi em, còn do dự, trời tối mất!