JDK-7123170 : JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: hs23,7u4
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-12-20
  • Updated: 2019-08-16
  • Resolved: 2012-03-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Description
JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/resexh00101.html test fails since 7u4 b02.

The otput:
java version "1.7.0_04-ea"
Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b02)
Java HotSpot(TM) Server VM (build 23.0-b06, mixed mode)

[check] Unexpected count: 0

Live phase test version:
Successfully attached to JVM with id: 24120
Native agent successfully loaded:  name=jckjvmti  opts=resexh00101
[check] Unexpected count: 0

Test passed on jdk7u4 b01, on jdk7 fcs.
The output of passed tests:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b148)
Java HotSpot(TM) Client VM (build 21.0-b18, mixed mode)

ResourceExhausted event initiated:
        description: Java heap space
        flags: 0003
Live phase:
Successfully attached to JVM with id: 23566
Native agent successfully loaded:  name=jckjvmti  opts=resexh00101
ResourceExhausted event initiated:
        description: Java heap space
        flags: 0003

Please see more in comments.

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hsx23/hotspot/rev/a5f2ffa62a17
21-03-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/a735aec54ea4
16-03-2012

SUGGESTED FIX Integrated into hs24/b04 changset: http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a735aec54ea4
15-03-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a735aec54ea4
15-03-2012

SUGGESTED FIX Suggested fix: --- old/src/share/vm/oops/arrayKlass.cpp Tue Mar 13 15:19:17 2012 +++ new/src/share/vm/oops/arrayKlass.cpp Tue Mar 13 15:19:16 2012 @@ -153,6 +153,12 @@ } if (length > arrayOopDesc::max_array_length(T_ARRAY)) { report_java_out_of_memory("Requested array size exceeds VM limit"); + + if (JvmtiExport::should_post_resource_exhausted()) { + JvmtiExport::post_resource_exhausted( + JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, + "Requested array size exceeds VM limit"); + } THROW_OOP_0(Universe::out_of_memory_error_array_size()); } int size = objArrayOopDesc::object_size(length); --- old/src/share/vm/oops/instanceKlass.cpp Tue Mar 13 15:19:20 2012 +++ new/src/share/vm/oops/instanceKlass.cpp Tue Mar 13 15:19:19 2012 @@ -669,6 +669,11 @@ if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); if (length > arrayOopDesc::max_array_length(T_OBJECT)) { report_java_out_of_memory("Requested array size exceeds VM limit"); + if (JvmtiExport::should_post_resource_exhausted()) { + JvmtiExport::post_resource_exhausted( + JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, + "Requested array size exceeds VM limit"); + } THROW_OOP_0(Universe::out_of_memory_error_array_size()); } int size = objArrayOopDesc::object_size(length); --- old/src/share/vm/oops/objArrayKlass.cpp Tue Mar 13 15:19:22 2012 +++ new/src/share/vm/oops/objArrayKlass.cpp Tue Mar 13 15:19:22 2012 @@ -68,6 +68,11 @@ return a; } else { report_java_out_of_memory("Requested array size exceeds VM limit"); + if (JvmtiExport::should_post_resource_exhausted()) { + JvmtiExport::post_resource_exhausted( + JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, + "Requested array size exceeds VM limit"); + } THROW_OOP_0(Universe::out_of_memory_error_array_size()); } } else { --- old/src/share/vm/oops/typeArrayKlass.cpp Tue Mar 13 15:19:25 2012 +++ new/src/share/vm/oops/typeArrayKlass.cpp Tue Mar 13 15:19:24 2012 @@ -93,6 +93,11 @@ return t; } else { report_java_out_of_memory("Requested array size exceeds VM limit"); + if (JvmtiExport::should_post_resource_exhausted()) { + JvmtiExport::post_resource_exhausted( + JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, + "Requested array size exceeds VM limit"); + } THROW_OOP_0(Universe::out_of_memory_error_array_size()); } } else {
14-03-2012

EVALUATION % setenv JCK "/net/hsdev-13/export/ss45998/JCK-runtime-7" The JCK resexh00101 test sources are located here: $JCK/tests/vm/jvmti/ResourceExhausted/resexh001/resexh00101 I've modified the test as follows: *** resexh00101.java.orig Tue Mar 13 01:17:04 2012 --- resexh00101.java Tue Mar 13 01:41:13 2012 *************** *** 76,83 **** new HashMap(Integer.MAX_VALUE)); } } ! } catch (OutOfMemoryError ok) { map = null; return check(); } --- 76,84 ---- new HashMap(Integer.MAX_VALUE)); } } ! } catch (OutOfMemoryError er) { map = null; + System.err.println("Serg: OOM: " + er.getMessage()); return check(); } With this test update the output is: java version "1.7.0_04-ea" Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b02) Java HotSpot(TM) Server VM (build 23.0-b06, mixed mode) Serg: OOM: Requested array size exceeds VM limit [check] Unexpected count: 0 Checking the Hotspot sources ---------------------------- % cd /net/hsdev-13/export/ss45998/jfr_jdk/hotspot/src/share/vm % grep report_java_out_of_memory */* | grep -v utilities gc_interface/collectedHeap.inline.hpp: report_java_out_of_memory("Java heap space"); gc_interface/collectedHeap.inline.hpp: report_java_out_of_memory("GC overhead limit exceeded"); gc_interface/collectedHeap.inline.hpp: report_java_out_of_memory("PermGen space"); oops/arrayKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); oops/instanceKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); oops/objArrayKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); oops/typeArrayKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); The ResourceExhausted event is posted in the gc_interface/collectedHeap.inline.hpp: if (!gc_overhead_limit_was_exceeded) { // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support report_java_out_of_memory("Java heap space"); if (JvmtiExport::should_post_resource_exhausted()) { JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP, "Java heap space"); } THROW_OOP_0(Universe::out_of_memory_error_java_heap()); } else { // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support report_java_out_of_memory("GC overhead limit exceeded"); if (JvmtiExport::should_post_resource_exhausted()) { JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP, "GC overhead limit exceeded"); } THROW_OOP_0(Universe::out_of_memory_error_gc_overhead_limit()); } . . . // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support report_java_out_of_memory("PermGen space"); if (JvmtiExport::should_post_resource_exhausted()) { JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, "PermGen space"); } THROW_OOP_0(Universe::out_of_memory_error_perm_gen()); But the event is not posted in the oops/*arrayKlass.cpp when the OOM message "Requested array size exceeds VM limit" is returned. oops/arrayKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); THROW_OOP_0(Universe::out_of_memory_error_array_size()); oops/instanceKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); THROW_OOP_0(Universe::out_of_memory_error_array_size()); oops/objArrayKlass.cpp: report_java_out_of_memory("Requested array size exceeds VM limit"); THROW_OOP_0(Universe::out_of_memory_error_array_size()); oops/typeArrayKlass.cp: report_java_out_of_memory("Requested array size exceeds VM limit"); THROW_OOP_0(Universe::out_of_memory_error_array_size()); Summary: The changesets from Tony's integration have no updates of the files above. So, this fix has just triggered a different code path for this JCK test. Most likely, the bug existed in the sources for some time (maybe always). We need to check if there is a reason why the ResourceExhausted JVMTI event is not posted for these 4 cases? Perhaps, we need to check if there are other places where the OOM is reported.
13-03-2012