4.2.5 javacore
Acquiring the core file and thread dump
Synopsis
javacore [-i|-f] [-force] -p process-ID
Storage location
Application Server installation directory/jdk/jre/bin/
Function
This command collects a core file and a thread dump simultaneously 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.
Arguments
- -i
-
Displays the messages for checking the execution of the core file and the thread dump output process. Enter y or n for the displayed messages. In such cases, when you enter y, the thread dump is output and when you enter n, the process ends without performing any operation. When omitted, this option is valid as long as the -f option is not specified.
- -f
-
Invalidates the -i option. If omitted, the -i option is enabled.
- -force
-
Outputs core for the java process with the process ID specified in the -p option without confirming the existence of the /tmp/hsperfdata_user-name/process-ID file created with the java process.
- -p process-id
-
Specifies the process-ID of the Java program from which the core file and thread dump are to be collected.
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 Resource Limits - RLIMIT_CPU :number-of-seconds-available-for-the-process RLIMIT_FSIZE :maximum-file-size-(-unit-:-byte-) RLIMIT_DATA :mallocable-size-(-unit-:-byte-) RLIMIT_STACK :maximum-stack-size-(-unit-:-byte-) RLIMIT_CORE :maximum-core-size-(-unit-:-byte-) RLIMIT_RSS :process-residence-size-(-unit-:-byte-) RLIMIT_AS :available-memory-for-total-processes-(-unit-:-byte-) RLIMIT_NOFILE :maximum-file-descriptor-value
- 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 environment
-
Application Environment ----------------------- Signal Handlers -#1 SIGHUP :signal-handler-information SIGINT :signal-handler-information ... SIGSOUND :signal-handler-information SIGSAK :signal-handler-information Signal Handlers - signal-type: [signal-handler-address], sa_mask[0]= signal-mask, sa_flags= specific-flag ... Environment Variables -#2 environment-variable=value ... Current Directory - Application Server installation directory/CC/server/...
- #1
-
The following information is displayed:
- If the signal handler is installed, its address is displayed.
- In the case of SIG_DFL, default is displayed.
- In the case of SIG_IGN, ignored is displayed.
- #2
-
The following information is displayed:
- The signal name defined in /usr/include/sys/signal.h is displayed in signal type.
- The address of the signal handler is output as hexadecimal in the "signal handler address". The address may be displayed in the form of "Library name + Offset."
- The sa_mask field value of the structure fetched by sigaction() is output as hexadecimal in the "signal mask".
- The sa_flags field value of the structure fetched by sigaction() is output as hexadecimal in the "specific flag".
- Library information (in Linux)
-
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: This is output when the monitor has an owner.
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
-
Execution of the javacore command, with the -f option omitted:
javacore -p 8326
-
A message for confirming the execution of the core file and the thread dump output process is displayed:
send SIGQUIT to 8326:?(y/n)
-
Enter y to collect the core file and thread dump (otherwise enter n):
send SIGQUIT to 8326:?(y/n)y
-
When the core file and thread dump are collected, the Java program being executed outputs the following message:
Now generating core file (javacore8662.030806215140.core)... done (thread-dump-output) Writing Java core to javacore8662.030806215140.txt... OK
-
The Java program being executed creates the following files under the current directory and continues the program:
-
Core file
javacoreprocess-id.time.core
-
Thread dump
javacoreprocess-id.time.txt
-
Exit Status
Exit Status |
Explanation |
---|---|
0 |
The command terminated normally. |
1 |
The command terminated abnormally. |
2 |
The core generation process did not return a response within the specified timeout time. |
Output messages
If any of the error messages described below or a warning message is issued, the core file and thread dump have not been collected.
No. |
Error message |
Explanation |
---|---|---|
1 |
usage: javacore [-f|-i] [-force] -p process-id |
A command argument is invalid. |
2 |
javacore: can't create work file at /tmp, this request canceled |
The user does not have permission to reference or write data into /tmp. |
3 |
javacore: illegal option --option |
The indicated option specified in the command arguments is invalid. |
4 |
javacore: unexpected error occurred:error-cause |
An unexpected error occurred during command execution. |
5 |
javacore: please delete name-of-undeleted-file in full-path-of- undeleted-file |
When the command terminated, a file created by the internal process of the javacore command could not be deleted. Delete the non-deleted file in the full-path-of-the-non-deleted-file. |
6 |
process-id: No such process |
No process is found that matches the process indicated by process-id specified in the argument of the javacore command or the process indicated by process-id specified in the javacore command is not the java process. |
7 |
process-id: Not owner |
The executing user is not the owner of the process indicated by process-id specified in the command. |
8 |
process-id: Now processing previous request, this request canceled |
The process indicated by process-id specified in the command is currently generating a core. |
9 |
process-id: Timeout occurred. Java process not responding. |
The process indicated by process-id specified in the argument of the command does not return a response indicating that the core output processing terminated within the fixed time. |
Notes
-
The javacore command sends the SIGQUIT signal to the specified process. If a program other than a Java program is specified by mistake, other programs may stop.
-
The javacore command cannot be executed concurrently for the same Java process. You execute the command after the core output processing by the previous javacore command has terminated.
-
If a Java VM process has not responded to a thread dump collection request and has gone onto no-response status, you cannot use the javacore command to collect the core file. In such a case, execute the kill -6 command to terminate the Java VM process forcibly, then collect the core file.
-
In Linux, generate core with the gcore command of gdb. If gdb is not installed, the following error message will be output as the standard output:
Error occurred in generating core file, gdb not found.
Furthermore, if the installed gdb is from an old version, the following message will be output as the standard output:
Error occurred in generating core file, gdb version 5.2 or later needed.
-
The javacore command uses the /tmp/hsperfdata_user-name/process-ID file at runtime. If the applicable file does not exist, the core file cannot be output by the javacore command.
However, if the -force option is specified, core is output for the Java process indicated by the process ID that is specified in the -p option without confirming the existence of the /tmp/hsperfdata_user-name/process-ID file.