Hitachi

Hitachi Application Server V10 Command Reference Guide (For UNIX® Systems)


4.2.6 javagc

forced execution of garbage collection

Synopsis

javagc [-i|-f] [-v] [-s] [-force] [-ehgc] -p process-ID

Storage location

Application Server installation directory/jdk/jre/bin/

Function

This command executes full garbage collection at a desired time for the Java process whose process ID is process-ID, such as when a memory leak or system error has occurred, or when application debugging is to be performed. Also, executes the full garbage collection and the Explicit memory block release at any time, for the Java process with the specified process- ID.

The SIGQUIT signal is used for communicating with a Java process. When the command is executed, requests user to check the process contents of the command. When the response is n (do not generate, execute, or send), the command does not execute the process contents of the command (the return value is 1). You can omit this configuration step by specifying the -f option.

If a copy garbage collection or a full garbage collection that occurs because of normal causes is running in the java process indicated by process-ID, you wait for the garbage collection to end, and then execute the command.

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

Does not ask the user to check the process contents of the following command:

  • Whether to execute the Explicit memory block release for the process given in process-ID

  • Whether to send the SIGQUIT signal for generating the garbage collection

A specification of the -f option before the -i option is ignored.

-f

Does not ask the user to check the process contents of the following command:

  • Whether to execute the Explicit memory block release

  • Whether to send the SIGQUIT signal for generating the garbage collection

A specification of the -i option before the -f option is ignored.

-v

If the -XX:+HitachiVerboseGC option is not specified, creates a Java VM log file according to the Java VM log file creation rules and outputs the extended verbosegc information.

In such cases, output the extended verbosegc information of the contents, also with the effect of the following option values:

  • -XX:+HitachiVerboseGCPrintDate

  • -XX:+HitachiVerboseGCPrintCause

  • -XX:+HitachiVerboseGCCpuTime

  • -XX:+HitachiCommaVerboseGC

-s

Outputs the extended verbosegc information to the standard output.

In such cases, -s outputs the extended verbosegc information of the contents in which the following option values are also reflected:

  • -XX:+HitachiVerboseGCPrintDate

  • -XX:+HitachiVerboseGCPrintCause

  • -XX:+HitachiVerboseGCCpuTime

  • -XX:+HitachiCommaVerboseGC

-force

Executes the garbage collection or the Explicit memory block release 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 created in the java process.

-ehgc

Executes the full garbage collection and the Explicit memory block release for the Java process with the specified process-ID.

You can explicitly release the Explicit memory blocks, which were not released by release processing when the automatic release functionality is enabled.

When you execute the javagc command, Java VM executes a full garbage collection and outputs the EMJavaGC command as the cause of the garbage collection in extended the verbosegc information. After that, the following Explicit memory blocks are released:

  • Explicit memory blocks that are reserved by explicit release reservation, when automatic release functionality of the Explicit Memory Management functionality is enabled

  • Explicit memory blocks generated by the explicit management heap automatic placement configuration file or Java VM

  • Explicit memory blocks that were not released in the previous release processing

The release processing is not executed in the following cases:

  • When you try to release Explicit memory blocks exceeding the maximum limit

    This refers to the case when the number of existing Explicit memory blocks is 1,048,575.

  • When the Explicit Memory Management functionality is OFF

    This refers to the case when -XX:-HitachiUseExplicitMemory option is specified.

In this case, although the constructor is successfully executed, memory blocks are handled as invalid Explicit memory blocks (ExplicitMemory instances).

With release processing of Explicit memory blocks by using the javagc command, a full garbage collection is executed. Hence, it is not appropriate for the processing related to running applications. We recommend that you execute release processing when the application is not running, such as at the time of undeploying and at night time.

-p process-id

Specifies a process ID for which a full garbage collection or the Explicit memory block release is to be executed.

Type: Integer

The following values can be specified:

  • 0 to 4294967295

Output format (In the case of SerialGC)

If the option v or s is specified, the Java VM log is output."

[id] <date> (Skip Full:full_count, Copy:copy_count) [gc_kind gc_info, gc_time secs][Eden: eden_info][Survivor: survivor_info][Tenured: tenured_info][Metaspace: Metaspace_info][class space: class_space_info] [cause:cause_info] [User: user_cpu secs][Sys: system_cpu secs][IM: jvm_alloc_size, mmap_total_size, malloc_total_size][TC: thread_count][DOE: doe_alloc_size, called_count][CCI: cc_used_sizeK, cc_max_sizeK, cc_infoK]

The following is a description of the output contents:

id

Identifier of the JavaVM log file.

date

Indicates the date and time for starting garbage collection.

When the -XX:-HitachiVerboseGCPrintDate option is specified, the date is not output.

full_count

Indicates the number of times the output of full GC information is skipped.

This is output when the -XX:HitachiVerboseGCIntervalTime option is specified.

copy_count

Indicates the number of times the output of copy GC information is skipped.

This is output when the -XX:HitachiVerboseGCIntervalTime option is specified.

gc_kind

Indicates the garbage collection type. "FullGC" or "GC" is output.

gc_info

Indicates the garbage collection information. The information is output in the following format:

area-length-before-the-garbage-collection -> area-length-after-the-garbage-collection (area-size)

gc_time

Indicates the elapsed time for garbage collection.

Eden

Indicates the type of eden. "DefNew::Eden" is output.

eden_info

Indicates the Eden information. The information is output in the following format:

area-length-before-the-garbage-collection -> area-length-after-the-garbage-collection (area-size)

Survivor

Indicates the survivor type. "DefNew:: Survivor" is output.

survivor_info

Indicates the Survivor information. The information is output in the following format:

area-length-before-the-garbage-collection -> area-length-after-the-garbage-collection (area-size)

Tenured

Indicates the type of Tenured. "Tenured" is output.

tenured_info

Indicates the Tenured information. The information is output in the following format:

area-length-before-the-garbage-collection -> area-length-after-the-garbage-collection (area-size)

Metaspace_info

Indicates memory information of the Metaspace area. This is output in the following format, in kilobytes:

<const1>K(<const2>K, <const3>K)-><const4>K(<const5>K, <const6>K)]

  • <const1>: The size of the used Metaspace area before GC

  • <const2>: The size of the capacity of the Metaspace area before GC

  • <const3>: The size of the committed Metaspace area before GC

  • <const4>: The size of the used Metaspace area after GC

  • <const5>: The size of the capacity of the Metaspace area after GC

  • <const6>: The size of the committed Metaspace area after GC

class_space_info

Indicates memory information of the "class space" area. This is output in the format below, in kilobytes.

If the compressed-object pointer functionality is disabled, this information is not output.

<const1>K(<const2>K, <const3>K)-><const4>K(<const5>K, <const6>K)]

  • <const1>: The size of the used "class space" area before GC

  • <const2>: The size of the capacity of the "class space" area before GC

  • <const3>: The size of the committed "class space" area before GC

  • <const4>: The size of the used "class space" area after GC

  • <const5>: The size of the capacity of the "class space" area after GC

  • <const6>: The size of the committed "class space" area after GC

cause_info

Indicates the cause of garbage collection.

When the -XX:-HitachiVerboseGCPrintCause option is specified, this information is not output.

user_cpu

Indicates the CPU time that the garbage collection thread has consumed in the user mode. The unit is in seconds.

If an attempt to obtain the CPU time fails, unknown is displayed as in the case of [User: unknown].

When the -XX:-HitachiVerboseGCCpuTime option is specified, the information is not output.

system_cpu

Indicates the CPU time that the garbage collection thread has consumed in the kernel mode. The unit is in seconds.

If an attempt to obtain the CPU time, unknown is displayed as in the case of [Sys: unknown].

When the -XX:-HitachiVerboseGCCpuTime option is specified, the information is not output.

jvm_alloc_size

Specifies the size of the area currently in use, from the areas being managed in Java VM (size of the area currently in use, from the total size of mmap_total_size and malloc_total_size).

When the -XX:HitachiVerboseGCPrintJVMInternalMemory option is specified, this information is not output.

mmap_total_size

Specifies the total C heap size allocated for mmap (VirtualAlloc in Windows), from the areas being managed in Java VM.

When the -XX:-HitachiVerboseGCPrintJVMInternalMemory option is specified, this information is not output.

malloc_total_size

Specifies the total C heap size allocated for malloc, from the areas being managed in Java VM.

When the -XX:-HitachiVerboseGCPrintJVMInternalMemory option is specified, this information is not output.

thread_count

Specifies the number of Java threads.

When the -XX:-HitachiVerboseGCPrintThreadCount option is specified, this information is not output.

doe_alloc_size

Specifies the cumulative heap size allocated by invoking the java.io.File.deleteOnExit()method.

When the -XX:-HitachiVerboseGCPrintDeleteOnExit option is specified, this information is not output.

called_count

Specifies the invocation count of the java.io.File.deleteOnExit() method.

When the -XX:-HitachiVerboseGCPrintDeleteOnExit option is specified, this information is not output.

cc_used_size

Specifies the size of the code cache area used when the garbage collection occurs. The unit is kilobyte.

When the -XX:-PrintCodeCacheInfo option is specified, this information is not output.

cc_max_size

Specifies the maximum size of the code cache area. The unit is kilobyte.

When the -XX:-PrintCodeCacheInfo option is specified, this information is not output.

cc_info

Specifies the maintenance information.

When the -XX:-PrintCodeCacheInfo option is specified, this information is not output.

Output format (In the case of G1GC)

If the option v or s is specified, the Java VM log is output."

In G1GC, the log relating to GC (VG1 log hereafter) and the log relating to Concurrent Marking (CM) (VCM log hereafter) are output to the Java VM log file. CM and applications are processed in parallel, so one CM log is output into multiple lines.

The following shows the details of the output formats of the VG1 log and VCM log:

VG1 log

[id]<date>[gc_kind gc_info, gc_time secs][Status:gc_status][G1GC::Eden: eden_info][G1GC::Survivor: survivor_info][G1GC::Tenured: tenured_info][G1GC::Humongous: humongous_info][G1GC::Free: free_info][Metaspace: Metaspace_info][class space: class_space_info] [cause:cause_info][RegionSize: region_sizeK][Target: target_time secs][Predicted: predicted_time secs][TargetTenured: target_sizeK][Reclaimable: reclaimable_info][User: user_cpu secs][Sys: system_cpu secs][IM: jvm_alloc_sizeK, mmap_total_sizeK, malloc_total_sizeK][TC: thread_count][DOE: doe_alloc_sizeK, called_count][CCI: cc_used_sizeK, cc_max_sizeK, cc_infoK]

Note that there are no line break and space between items.

Item to be Output

Content of the Output

Meaning

id

VG1

Indicates the identifier of the Java VM log file. [VG1] is output in the GC log of G1GC.

date

<letters>

Indicates the date and time when GC or CM was started. This item is not output if -XX:-HitachiVerboseGCPrintDate is specified.

gc_kind

Full GC| Mixed GC|Young GC |Young GC(initial-mark)|CM Remark|CM Cleanup

Indicates the type of GC or CM.

gc_info

<const1>K/<const2>K(<const3>K)-><const4>K/<const5>K(<const6>K)

Indicates memory information of the Java heap area.

<const1>: The size of the used Java heap area before GC

<const2>: The size of the used Java heap area before GC (region equivalent)#1

<const3>: The size of the Java heap area before GC (region equivalent)

<const4>: The size of the used Java heap area after GC

<const5>: The size of the used Java heap area after GC (region equivalent)

<const6>: The size of the Java heap area after GC (region equivalent)

These are output in kilobytes.

gc_time

<time>

Indicates the time the application was stopped by GC.

This is output in seconds.

gc_status

-|to exhausted

Indicates the GC status.

  • If an overflow occurs in the To area, to exhausted is output.

  • For statuses other than above, - is output.

The following shows the statuses output for each GC.

If "gc_kind" is "Young GC", "Young GC (initial-mark)" or "Mixed GC": - or to exhausted is output.

If "gc_kind" is other than above: - is output.

eden_info

<const1>K(<const2>K)-><const3>K(<const4>K)

Indicates memory information of the Eden area.

<const1>: The size of the used Eden area before GC (region equivalent)

<const2>: The possible maximum size of the Eden area before GC (region equivalent)#2

<const3>: The size of the used Eden area after GC (region equivalent)

<const4>: The possible maximum size of the Eden area after GC (region equivalent)#2

These are output in kilobytes.

survivor_info

<const1>K-><const2>K

Indicates memory information of the Survivor area.

<const1>: The size of the used Survivor area before GC (region equivalent)

<const2>: The size of the used Survivor area after GC (region equivalent)

These are output in kilobytes.

tenured_info

<const1>K-><const2>K

Indicates memory information of the Tenured area.

<const1>: The size of the used Tenured area before GC (region equivalent)

<const2>: The size of the used Tenured area after GC (region equivalent)

These are output in kilobytes.

humongous_info

<const1>K-><const2>K

Indicates memory information of the Humongous area.

<const1>: The size of the used Humongous area before GC (region equivalent)

<const2>: The size of the used Humongous area after GC (region equivalent)

These are output in kilobytes.

free_info

<const1>K-><const2>K

Indicates memory information of the Free area.

<const1>: The size of the used Free area before GC (region equivalent)

<const2>: The size of the used Free area after GC (region equivalent)

These are output in kilobytes.

Metaspace_info

<const1>K(<const2>K, <const3>K)-><const4>K(<const5>K, <const6>K)]

Indicates memory information of the Metaspace area.

  • <const1>: The size of the used Metaspace area before GC

  • <const2>: The size of the capacity of the Metaspace area before GC

  • <const3>: The size of the committed Metaspace area before GC

  • <const4>: The size of the used Metaspace area after GC

  • <const5>: The size of the capacity of the Metaspace area after GC

  • <const6>: The size of the committed Metaspace area after GC

These are output in kilobytes.

class_space_info

<const1>K(<const2>K, <const3>K)-><const4>K(<const5>K, <const6>K)]

Indicates memory information of the "class space" area.

This item is not output if the compressed-object pointer functionality is disabled.

  • <const1>: The size of the used "class space" area before GC

  • <const2>: The size of the capacity of the "class space" area before GC

  • <const3>: The size of the committed "class space" area before GC

  • <const4>: The size of the used "class space" area after GC

  • <const5>: The size of the capacity of the "class space" area after GC

  • <const6>: The size of the committed "class space" area after GC

These are output in kilobytes.

cause_info

<letters>

Indicates the detailed cause of GC.

This item is not output if -XX:-HitachiVerboseGCPrintCause is specified.

region_size

<const>

Indicates the size of one region.

This is output in kilobytes.

target_time

<time>

Indicates the target time during which an application is stopped by GC.

This is output in seconds.

predicted_time

<time>

Indicates the time during which an application is stopped by GC, as predicted by Java VM.

This is output in seconds.

If the GC type is Full GC, CM Remark, or CM Cleanup, the time is not predicted and 0 is output.

target_size

<const>

Indicates the size of the Tenured area targeted for GC by Mixed GC.

This is output in kilobytes.

If the GC type is other than Mixed GC, 0 is output.

reclaimable_info

<const1>K(<const2>.<digit><digit>%)

Indicates the predicted collection size information.

<const1>: The predicted collection size

This is output in kilobytes.

<const2>.<digit><digit>: The predicted collection rate (to two decimal places)

The predicted collection size information is output only for Young GC or Mixed GC immediately after the end of CM. In other cases, the size is not predicted and 0 is output.

user_cpu

<time>

Indicates the total CPU time spent in the user mode by all the GC threads.

This is output in seconds.

This item is not output if -XX:-HitachiVerboseGCCpuTime is specified.

If collection of the CPU time fails, unknown is displayed as follows: [User: unknown]

system_cpu

<time>

Indicates the total CPU time spent in the kernel mode by the all GC thread.

This is output in seconds.

This item is not output if -XX:-HitachiVerboseGCCpuTime is specified.

If collection of the CPU time fails, unknown is displayed as follows: [Sys: unknown]

#1: "Region equivalent" is a value indicated by multiples of the size of one region, calculated by rounding up the area size by the size of one region.

#2: The possible maximum size of the Eden area is: (size of New area) - (size of used Survivor area).

The VCM log

[id]<date> [cm_event][User: user_cpu secs][Sys: sys_cpu secs]

#No line break. #No space between items.

Items to be Output

Content of the Output

Meaning

id

VCM

Indicates the identifier of the Java VM log file. [VCM] is output in the CM log of G1GC.

date

<letters>

Indicates the date and time when CM was started.

This item is not output if -XX:-HitachiVerboseGCPrintDate is specified.

cm_event

Concurrent Root Region Scan Start|Concurrent Root Region Scan End|Concurrent Mark Start|Concurrent Mark End|Concurrent Mark Stop|Concurrent Cleanup Start|Concurrent Cleanup End

Indicates the CM status.

Concurrent Root Region Scan Start: Concurrent Root Region Scan started.

Concurrent Root Region Scan End: Concurrent Root Region Scan ended.

Concurrent Mark Start: Concurrent Mark started.

Concurrent Mark End: Concurrent Mark ended.

Concurrent Mark Stop: Concurrent Mark stopped.

Concurrent Cleanup Start: Concurrent Cleanup started.

Concurrent Cleanup End: Concurrent Cleanup ended.

usr_cpu

<time>

Indicates the total CPU time spent in the user mode by the all CM thread.

This is output in seconds.

This item is not output if -XX:-HitachiVerboseGCCpuTime is specified.

If collection of the CPU time fails, unknown is displayed as follows: [User: unknown]

If the CM status is "Start", 0 is output.

sys_cpu

<time>

Indicates the total CPU time spent in the kernel mode by the all CM thread.

This is output in seconds.

This item is output if -XX:-HitachiVerboseGCCpuTime is specified.

If collection of the CPU time fails, unknown is displayed as follows: [Sys: unknown]

If the CM status is "Start", 0 is output.

Input examples

  1. Execution of the javagc command, with the -i option specified:

    javagc -i -v -p 8326

  2. A process ID confirmation message is displayed:

    send SIGQUIT to 8326:?(y/n)

  3. Enter y to send the SIGQUIT signal or n to not send the signal:

    send SIGQUIT to 8326:?(y/n)y

Output example

The VG1 log:

[VG1]<Thu Oct 02 10:38:56.193 2014>[Full GC 753K/2048K(8192K)->678K/1024K(8192K), 0.0097901 secs][Status:-][G1GC::Eden: 1024K(2048K)->0K(2048K)][G1GC::Survivor: 0K->0K][G1GC::Tenured: 1024K->1024K][G1GC::Humongous: 0K->0K][G1GC::Free: 6144K->7168K] [Metaspace: 3634K(4492K, 4492K)->3634K(4492K, 4492K)][class space: 356K(388K, 388K)->356K(388K, 388K)] [cause:System.gc][RegionSize: 1024K][Target: 0.2000000 secs][Predicted: 0.0000000 secs][TargetTenured: 0K][Reclaimable: 0K(0.00%)][User: 0.0000000 secs][Sys: 0.0000000 secs][IM: 20459K, 21920K, 0K][TC: 35][DOE: 0K, 0][CCI: 1172K, 245760K, 2496K]

The VCM log:

[VCM]<Wed Jul 24 11:45:20 2013>[Concurrent Root Region Scan Start][User: 0.0000000 secs][Sys: 0.0000000 secs] [VCM]<Wed Jul 24 11:45:20 2013>[Concurrent Root Region Scan End][User: 0.0126134 secs][Sys: 0.0146961 secs] [VCM]<Wed Jul 24 11:45:20 2013>[Concurrent Mark Start][User: 0.0000000 secs][Sys: 0.0000000 secs] [VCM]<Wed Jul 24 11:45:34 2013>[Concurrent Mark End][User: 0.0156250 secs][Sys: 0.2495800 secs]

Exit Status

Exit Status

Explanation

0

The command terminated normally.

1

The command terminated abnormally.

2

A response indicating that garbage collection was completed was not received within the specified amount of time.

Output messages

If any of the following error or warning messages is output, an extended thread dump with detailed information of the Explicit heap is not output:

No.

Error message

Explanation

1

javagc [-f|-i][-v][-s] [-force] [-ehgc] -p process-id

An argument specified in the javagc command is invalid.

2

javagc: illegal option--option

The indicated option (option) specified in the javagc command arguments is invalid.

3

process-id: No such process

The process indicated by process-id specified in the argument of the javagc command is not found or the process indicated by process-id specified in the javagc command is not the java process.

4

process-id: Not owner

The executing user is not the owner of the process indicated by process-id specified in the javagc command.

5

process-id: Now processing previous request, this request canceled

The process indicated by process-id specified in the argument of the javagc command is currently executing the garbage collection using the previous javagc command. The javagc command cancels the garbage collection execution request.

6

javagc: can't create work file at /tmp, this request canceled

The user does not have permission to reference or write data into /tmp, so a garbage collection request file cannot be created. This garbage collection execution request is cancelled.

7

javagc: unexpected error occurred:error-cause

An unexpected error occurred during javagc command execution.

The following are examples of causes that may be displayed in error-cause:

  • When work memory could not be allocated:

    malloc systemcall fail (errno=Y)

  • When an object could not be closed:

    close systemcall fail (errno=Y)

8

process-id: Timeout occurred. Java process not responding.

The process indicated by process-id specified in the argument of the javagc command does not return a response indicating that the garbage collection is completed within the fixed time.

9

javagc : please delete name-of-undeleted-file in full-path-of-undeleted-file

When the javagc command terminated, it could not delete an internal file. Delete the indicated file on the indicated full path.

10

process-id: Failed to retry GC. Java process is GC locked.

The execution of GC by the process process-ID specified in an argument of the javagc command is suppressed, so GC could not be executed.

Notes