4.2.3 javacore
Acquiring the thread dump
Synopsis
javacore [-i|-f] -p process-ID
Storage location
Application Server installation directory\jdk\jre\bin\
Function
This command collects a thread dump during execution.
Execution permission
Execute the command as the same user as the user of the java process specified by the process ID in the arguments.
Environment variable
When you change the output destination of files, specify the output destination in JAVACOREDIR.
Arguments
- -i
-
A message for confirming the execution of the thread dump output process is displayed. Enter y or n for the displayed message. In such cases, if you enter y, the thread dump is output and if you enter n, the process ends without performing any operation. If you omit this option, this option is enabled, when the -f option is not specified.
- -f
-
Disables the -i option. If you omit this option, the -i option is enabled.
- -p process-ID
-
In process-ID, specify the process ID of a Java program for acquiring the thread dump.
Type: Integer
The following values can be specified:
-
0 to 4294967295
-
Output format
- Header
-
EEE MMM dd hh:mm:ss yyyy# Full thread dump Java HotSpot(TM) Client VM (1.5.0_05-b05-CDK0850-build-date mixed mode) invoke-command-line ...
- #
-
EEE represents a day, MMM a month, and dd a date. hh represents hours, mm minutes, ss seconds, and yyyy represents a year.
- System settings
-
System Properties ----------------- Java Home Dir : installation-directory-of-JDK-execution-environment Java DLL Dir : installation-directory-of-library-configuring-JDK Sys Classpath : system-class-path User Args : Java-command-option-1 Java-command-option-2 ...
- Operating environment
-
Operating Environment --------------------- Host : host-name:IP-address OS : OS-version CPU : CPU-type, number-of-available-CPUs/number-of-CPUs-of-all-systems
- Memory information
-
Memory Status ------------- Memory in use : memory-usage-status-(-unit-:-percent-) Physical memory : physical-memory-usage# free Virtual memory : virtual-memory-usage# free Paging file : paging-usage# free
- #
-
Displayed in the format of available-size/total-size (Units: Bytes).
- Java heap information
-
In the case of SerialGC:
Heap Status ----------- def new generation max max size, total capacity, used size (max usage% used/max, total usage% used/total) [bottom, commit addr, reserve addr) eden space capacity, usage% used [bottom, top, reserve addr) from space capacity, usage% used [bottom, top, reserve addr) to space capacity, usage% used [bottom, top, reserve addr) tenured generation max max size, total capacity, used size (max usage% used/max, total usage% used/total) [bottom, commit addr, reserve addr) the space capacity, usage% used [bottom, top, used block, reserve addr) Metaspace max max size, capacity capacity words, committed committed size, reserved reserve size, used size (max usage% used/max, total usage% used/committed) class space max max size, capacity capacity words, committed committed size, reserved reserve size, used size (max usage% used/max, total usage% used/committed) [bottom, top, commit addr, reserve addr)
- max size
-
Indicates the maximum size in kilobytes.
In case of Metaspace, when -XX:MaxMetaspaceSize is not specified, the maximum size is not limited, and unlimited is output.
- capacity
-
Indicates the current capacity in kilobytes.
- capacity words
-
Indicates the total size of the memory area committed by Metaspace excluding free area. This is shown in kilobytes.
- committed size
-
Indicates the total size of the memory committed by Metaspace in kilobytes.
- reserve size
-
Indicates the size of reserved memory in kilobytes.
- size
-
Indicates the size of used memory in kilobytes.
- max usage
-
Indicates the usage to the maximum capacity.
In case of Metaspace, when -XX:MaxMetaspaceSize is not specified, the maximum size is not limited, and -% is output.
- total usage
-
Indicates the usage rate to the current capacity.
- bottom
-
Indicates the initial address of the area.
- top
-
This indicate the initial address of the used area.
- commit addr
-
Indicates the last address of the committed area.
- reserve addr
-
Indicates the last address of the reserved area.
- usage
-
Indicates the usage rate.
- used block
-
Indicates the initial address of the next empty block.
- Note
-
"class space" is output only when the compressed-object pointer functionality is enabled in a 64-bit Java VM environment and "Compressed Class Space" is used.
The value of "Metaspace" is the total value of whole "Metaspace" including "class space".
In case of G1GC
Heap Status ----------- garbage-first heap total heap capacity, used heap size [heap bottom, heap commit addr, heap reserve addr) region size region size, young region young (young size), survivor region survivors (survivor size) Metaspace max max size, capacity capacity words, committed committed size, reserved reserve size, used size (max usage% used/max, total usage% used/committed) class space max max size, capacity capacity words, committed committed size, reserved reserve size, used size (max usage% used/max, total usage% used/committed) [bottom, top, commit addr, reserve addr)
Detailed format of the items to be output
Item to be Output
Content of the Output
Meaning
heap capacity
<const>K
Indicates the size of the Java heap area in kilobytes.
Total size of (a) + total size of (b) + total size of (c) + total size of (d)
heap size
<const>K
Indicates the size of used Java heap area in kilobytes.
Total size of (a) + total size of (b) + total size of (c)
heap bottom
<ptr64>
Indicates the initial address of the Java heap area.
heap commit addr
<ptr64>
Indicates the last address of the committed Java heap area.
heap reserve addr
<ptr64>
Indicates the last address of the reserved Java heap area.
region size
<const>K
Indicates the size of one region in kilobytes.
young region
<const>
Indicates the number of used regions in the New area.
Number of regions of (a) + number of regions of (b)
young size
<const>K
Indicates the size of the used New area in kilobytes.
(number of regions of (a) + number of regions of (b)) * "region_size"
survivor region
<const>
Indicates the number of used regions in the Survivor area.
Number of regions of (b)
survivor size
<const>K
Indicates the size of the used Survivor area in kilobytes.
Number of regions of (b) * "region_size"
The items output for "Metaspace" and "class space" are the same as that in case of Serial GC. See "In case of Serial GC".
- (Legends)
-
(a): Eden area
(b): Survivor area
(c): Tenured area
(d): Free area
- Internal memory map information for Java VM
-
JVM Internal Memory Map ----------------------- memory-secure-function:address = start-address - end-address (size:size)
- Note:
-
Memory-secure-function: Either mmap() or malloc() is output.
start-address: Start address of the memory area is output as hexadecimal.
end-address: End address of the memory area is output as hexadecimal.
size: Size of the secured memory area is output (Units: Bytes).
- Internal memory size information for Java VM
-
JVM Internal Memory Status -------------------------- Heap Size :secured-memory-size# Alloc Size :used-memory-size# Free Size :free-memory-size#
- #
-
Unit: Bytes
- Application information
-
Application Environment ----------------------- Signal Handlers - SIGINT :signal-handler-information SIGILL :signal-handler-information ... SIGBREAK :signal-handler-information SIGABRT :signal-handler-information Environment Variables - environment-variable=value ... Current Directory - C:\Program Files\Hitachi\...
- Library information
-
Loaded Libraries ---------------- Dynamic libraries : start-address-end-address command start-address-end-address library ...
- Thread information
-
----------- "thread-name" daemon prio= priority jid=hash-value tid= thread-ID nid= nativeID status [start-address...end-address] java.lang.Thread.State: current-status-of-thread# stack= [stack-start-address..YellowPage-address..RedPage-address..stack-end-address] [user cpu time=user-time ms, kernel cpu time=kernel-time ms] [blocked count=block-count, waited count=standby-count] at class-name.method-name(method-information) ...
#
Information of current-status-of-thread is output only if JDK 6 is the base and the version is 08-10 or later.
The output contents are as follows:
- thread-name
-
The thread name specified in the constructor of the Thread class is output.
daemon: In the case of the daemon thread, thread name is output as "daemon".
priority: The priority set in the Thread#setPriority is output.
hash-value: The value same as the one obtained by invoking System.identityHashCode() is output as 8-digit hexadecimal.
thread-ID: Memory address of thread object.
nativeID: Thread ID of the OS level.
status: Thread state.
runnable
Running or executable thread in Object.wait(), waiting for monitor entry, or waiting on
condition
Thread waiting for monitor lock
sleeping
Thread in the suspended state
start-address: The top-level stack address of the Java frame is output as hexadecimal.
end-address: The top-level stack address with JavaLock is output as hexadecimal.
user-timeThe user time since the thread is started is output in milliseconds.
kernel-timeThe kernel time since the thread is started is output in milliseconds.
block-count: The number of times the process is blocked since the thread is started is output.
standby- count: The number of times the process is pending since the thread is started is output.
- current-status-of-thread
-
The message indicating the current status of thread is output. The contents of the message correspond to the java.lang.Thread.State enumerated type.
- stack-start- address
-
The stack start address is output in hexadecimals.
- YellowPage-address
-
The first address of the stack Yellow guard page is output in hexadecimals.
- RedPage-address
-
The first address of the stack Red guard page is output in hexadecimals.
- stack-end-address
-
The stack end address is output in hexadecimals.
- class-name
-
The class name is output.
- method-name
-
The method name is output.
- method-information
-
The following method information is output:
Native Method
The information is output in the case of the native method.
File name: Line number
The information is output when the Java method is compiled with the line number.
Unknown Source
The information is output when the Java method is compiled without the line number.
- Java monitor dump
-
Java monitor ------------ lock-object@hash-code owner-information standby-state:standby-thread-number standby-thread-information
The output contents are explained below:
- lock-object
-
The class name of the object to be locked is output.
- hash-code
-
The hash code to be obtained with Object.hashCode is output.
- owner-information
-
owner "thread-name"thread-ID: When the monitor has an owner, owner "thread-name"thread-ID is output.
no owner: When the monitor does not have an owner, "no owner" is output.
- standby-state
-
... waiting to enter: This state is displayed when the monitor is waiting for method execution.
... waiting to be notified: This state is displayed when the monitor is waiting for notification.
- standby-thread-count
-
The thread count is output.
- standby-thread-information
-
The information is output in the form of "thread-name" thread-ID.
- Information on the number of JNI global references
-
JNI Information --------------- JNI global references: JNI-global-reference-count
The output contents are explained below:
- JNI global reference count
-
The number of global references maintained by Java VM are output.
- Note:
-
Since the JNI global reference is reused even in Java VM, the numeric value does not reduce even after issuing the DeleteGlobalRef function supported by JNI to delete the JNI global reference. Even if the NewGlobalRef function is issued to create a new JNI global reference, the numeric value does not increase if the JNI global reference reused by Java VM is allocated.
- Explicit heap information and Explicit memory block information
-
Explicit Heap Status -------------------- max EH_MAX, total EH_TOTAL, used EH_USED, garbage EH_GARB (EH_PER1 used/max, EH_PER2 used/total, EH_PER3 garbage/used), EM_NUMS spaces exist Explicit Memories(EM_MGR_PTR) "EM_NAME" eid=EID(EM_PTR)/EM_TYPE, total EM_TOTAL, used EM_USED, garbage EM_GARB (EM_PER1 used/total, EM_PER2 garbage/used, FL_BLOCKS blocks) EM_STAT ...
Note the following:
-
A blank line exists between the Explicit heap information and Explicit memory block information.
-
The output order for the Explicit memory block information (which Explicit memory block will output) is not defined.
-
Two one-byte character spaces exist before EM_NAME.
-
A blank line exist as the last line. As a result, a blank line exist between the output of each Explicit memory block.
-
- Footer
-
Full thread dump completed. EEE MMM dd hh:mm:ss yyyy#
- #
-
EEE represents a day, MMM a month, and dd a date. hh represents hours, mm minutes, ss seconds, and yyyy represents a year.
The following compares standard thread dump information with extended thread dump information:
Output information |
Standard thread dump |
Extended thread dump |
---|---|---|
Header |
N |
Y |
System settings |
N |
Y |
Operation environment |
N |
Y |
Memory information (in Windows only) |
N |
Y |
Java heap information |
N |
Y |
Internal memory map information for Java VM |
N |
Y |
Internal memory size information for Java VM |
N |
Y |
Application environment |
N |
Y |
Library information |
N |
Y |
Thread information |
Y |
Y#1 |
Java monitor dump |
N |
Y |
Footer |
N |
Y |
Thread dump output destination |
Standard output |
Standard output#2 Java VM log fi |
- Legend:
-
Y: Information is output.
N: Information is not output.
- #1
-
Information such as the start and end address of stack is output.
- #2
-
The information is output when the -XX:+HitachiThreadDumpToStdout option is specified.
Examples
-
Execute the javacore command by omitting the -f option.
% javacore -p 8326
-
A message for checking the execution of the thread dump output process is displayed.
Output a thread dump:?(y/n)
-
Enter y, when you want to output the thread dump and enter n, when you do not want to output the thread dump.
Output a thread dump:?(y/n)y
-
The running java program creates the following file in the current directory and continues the program.
-
The thread dump
javacoreprocess-ID.date-and-time.txt
-
Exit Status
Exit Status |
Explanation |
---|---|
0 |
The command is terminated normally. |
1 |
The command is terminated abnormally. |
2 |
A response of the thread dump output process termination was not received in a specified time. |
Output messages
When the following error messages or warning messages are output, the thread dump is not acquired:
No. |
Error message |
Explanation |
---|---|---|
1 |
usage: javacore [-f|-i] [-force] -p process-id |
An argument of the command is invalid. |
2 |
javacore: illegal option --option |
option specified in an argument of the command is invalid. |
3 |
javacore: can't communicate with process process-id. |
A problem occurred in process-ID specified in an argument and hence the communication is not possible, or a process corresponding to process-ID specified in an argument does not exist. |
4 |
process-id: Not owner |
0 has been specified in process-ID specified in an argument of the command. |
5 |
process-id: Now processing previous request, this request canceled |
A process given in process-ID specified in an argument of the command is already running. |
6 |
javacore: can't create work file at temporary directory, this request canceled |
A reference permission and write permission is not assigned to the directory for temporary files. |
7 |
javacore: can't get temporary directory, this request canceled |
As GetTempPath()API returned an error, a directory for temporary files cannot be acquired. |
8 |
javacore: unexpected error occurred: error-cause |
An unexpected error occurred while executing a command. |
9 |
process-id: Timeout occurred. Java process not responding. |
A response of the thread dump output process termination is not received within a specified time, from a process corresponding to process-ID specified in an argument of the command. |
10 |
javacore: please delete non-deleted-file-name in full-path-of-the-non-deleted-file. |
A file created in an internal process of the javacore command, when the command termination could not be deleted. Delete the non-deleted file in full-path-of-the-non-deleted-file. |
Notes
-
You cannot concurrently execute the javacore command for the same Java processes. Execute the command when the thread dump output process by the previous javacore command ends.
-
In the following cases, a message process-ID: Timeout occurred. Java process not responding. is sometimes output and the javacore command terminates.
-
When you execute the javacore command for a Java process for which the used memory size exceeds 1 Gigabyte
-
When you execute the javacore command when the system is highly loaded
Even if a message is output, if core.process-ID is created in the current directory of the target Java process and the file size increases gradually, you can consider that the process is normally performed. In such cases, do not stop the Java process.
-