-XX:[+|-]HitachiOutOfMemoryHandling (OutOfMemory handling option)
- Organization of this page
Format
- -XX:+HitachiOutOfMemoryHandling
-
This option enables the OutOfMemory handling functionality.
- -XX:-HitachiOutOfMemoryHandling
-
This option disables the OutOfMemory handling functionality.
Description
Specify whether to enable the OutOfMemory handling functionality. This option is valid only when the J2EE server is executed in J2EE server mode.
Use the OutOfMemory handling functionality in combination with the forced termination functionality for OutOfMemory (-XX:+HitachiOutOfMemoryAbort). If the forced termination functionality for OutOfMemory (-XX:-HitachiOutOfMemoryAbort) is disabled, the OutOfMemory handling functionality will be disabled.
If the OutOfMemory handling functionality is enabled, the OutOfMemoryError throwing condition is determined when OutOfMemory occurs. Specifically, the functionality determines whether to continue J2EE server execution if an OutOfMemory error occurs due to shortage of the Java heap, metaspace area, or compressed class space during one of the following types of processing:
-
Request processing during the execution of Web applications (Servlets or JSPs) on the Web container
-
Processing during the execution of the Enterprise Bean invoked from an EJB client application
-
Processing during the execution of the Message-driven Bean
-
Processing during the execution of the Enterprise Bean invoked from Timer Service
After determining, if the J2EE server continues execution, the java.lang.OutOfMemoryError is thrown and only the request processing where OutOfMemory occurred is cancelled.
JavaVM performs the following operations based on the determined results. However, if java.lang.OutOfMemoryError is caught by a Web application, that processing is followed.
-
If the OutOfMemoryError throwing conditions are satisfied
The java.lang.OutOfMemoryError error is thrown and only the request processing where OutOfMemory occurred is cancelled.
-
If the OutOfMemoryError throwing conditions are not satisfied
JavaVM is terminated forcibly by the forced termination functionality for OutOfMemory.
The OutOfMemoryError throwing condition is as follows. Note that when JavaVM does not conform to the OutOfMemoryError throwing conditions, JavaVM is terminated forcibly by the forced termination functionality for OutOfMemory.
- OutOfMemoryError throwing conditions
-
When OutOfMemory occurs and if all the following conditions are applicable, JavaVM is said to satisfy the OutOfMemoryError throwing conditions and throws java.lang.OutOfMemoryError without terminating abnormally.
-
The cause of the OutOfMemory error is shortage of the Java heap, metaspace area, or compressed class space.
-
The OutOfMemory error occurred in the request processing during the execution of the Web applications (Servlets or JSPs) on the Web container, processing during the execution of the Enterprise Bean invoked from an EJB client application, processing during the execution of the Message-driven Bean, or processing during the execution of the Enterprise Bean invoked from Timer Service.
-
The throw OutOfMemoryError exclusion condition is not applicable.
-
- Throw OutOfMemoryError exclusion condition
-
The total number of the current OutOfMemory error and other OutOfMemory errors that occurred in the past hour due to shortage of the Java heap, metaspace area, or compressed class space exceeds the value specified for the -XX:HitachiOutOfMemoryHandlingMaxThrowCount option.
The following table describes the operations for the cause of OutOfMemory occurrence for the forced termination functionality for OutOfMemory and OutOfMemory handling functionality. Whether the OutOfMemory handling functionality is enabled affects the operation performed when the cause of the OutOfMemory error is shortage of the Java heap, metaspace area, or compressed class space.
Causes of OutOfMemory occurrence |
Is an operation performed for the forced termination functionality for OutOfMemory (Operations to be performed during OutOfMemory #1) |
Is an operation performed for the OutOfMemory handling functionality (Operations to be performed during OutOfMemory) |
---|---|---|
Java heap shortage |
An operation is performed (JavaVM is terminated forcibly). |
An operation is performed (an operation is performed according to the determined results#2). |
Metaspace area shortage |
An operation is performed (JavaVM is terminated forcibly). |
An operation is performed (an operation is performed according to the determined results#2). |
Compressed class space shortage |
An operation is performed (JavaVM is terminated forcibly). |
An operation is performed (an operation is performed according to the determined results#2). |
C heap shortage |
An operation is performed (JavaVM is terminated forcibly). |
An operation is not performed (JavaVM is terminated forcibly#3). |
Unknown |
An operation is not performed (java.lang.OutOfMemoryError is thrown). |
An operation is not performed (java.lang.OutOfMemoryError is thrown). |
Thread Limit |
An operation is not performed (java.lang.OutOfMemoryError is thrown). |
An operation is not performed (java.lang.OutOfMemoryError is thrown). |
- #1
-
This operation is performed when the OutOfMemory handling functionality is disabled (-XX:-HitachiOutOfMemoryHandling).
- #2
-
If the OutOfMemoryError throwing condition is satisfied, java.lang.OutOfMemoryError is thrown. If the OutOfMemoryError throwing condition is not satisfied, the processing shifts to the forced termination functionality for OutOfMemory and JavaVM is terminated forcibly.
- #3
-
JavaVM is terminated forcibly by the forced termination functionality for OutOfMemory.
If the OutOfMemory handling functionality is enabled and an OutOfMemory error occurs due to shortage of the Java heap, metaspace area, or compressed class space, the OutOfMemory error occurrence frequency information is output to a Java VM log file.
- Default value
-
-
-XX:-HitachiOutOfMemoryHandling
-
- Prerequisite options
-
-
-XX:+HitachiOutOfMemoryAbort
-
Output format
[id][Thread: thread_id]<date>[Handling: oom_count(max_oom_count)]
The following is a description of the output contents:
- id
-
OMH (Identifier of the Java VM log file).
- thread_id
-
Thread ID (tid output to the thread dump).
- date
-
Date when OutOfMemory was handled.
- oom_count
-
The total number of the current OutOfMemory error and other OutOfMemory errors that occurred in the past hour due to shortage of the Java heap, metaspace area, or compressed class space.
However, including the current OutOfMemory, even if the total value of the occurrence count within an hour exceeds 3601, the maximum value of the output items is 3601.
- max_oom_count
-
Value specified in the -XX:HitachiOutOfMemoryHandlingMaxThrowCount option.
Examples of output
[OMH][Thread: 0x00927f48]<Tue Aug 24 19:02:19 2010>[Handling: 1(60)]
Precautions
-
The OutOfMemory handling functionality does not resolve the root cause of the OutOfMemory error and does not prevent the termination of a J2EE server due to the OutOfMemory error. Also, this functionality does not guarantee that the J2EE server execution can be continued after the occurrence of the OutOfMemory error. This functionality is used to temporarily prevent the termination of a J2EE server when an OutOfMemory error occurs unexpectedly due to problems in user program processing.
The java.lang.OutOfMemoryError error occurs when a heap depletes, regardless of the OutOfMemory handling functionality settings. When the java.lang.OutOfMemoryError occurs, we recommend that you restart and recover the J2EE server as soon as possible, and then resolve the root cause of the OutOfMemory error.
Note that the resources might be leaked or locked by throwing the java.lang.OutOfMemoryError, and unexpected operations might occur in the J2EE server. Therefore, if the OutOfMemory error occurs when this functionality is enabled, perform operations so that the J2EE server is restarted at an appropriate time. Also, if you want to avoid unexpected operations in the J2EE server, disable this functionality. In this case, if the OutOfMemory error occurs unexpectedly, the J2EE server will be terminated.
If this functionality is enabled and if unexpected operations occur, restart the J2EE server. Also, disable this functionality in subsequent operations.
-
When the OutOfMemory handling functionality is enabled, even if the forced termination functionality is enabled (-XX:+HitachiOutOfMemoryAbort) during the OutOfMemory error, if the OutOfMemory error occurs during the processing of jsps and Servlets, java.lang.OutOfMemoryError is thrown as per the Java SE specifications instead of a forced termination.
Therefore, for example, if the resources are not released properly by using the finally clause, the resources might not be released.
To avoid such problems and to implement forced termination as before, disable the OutOfMemory handling functionality.