EVALUATION
http://hg.openjdk.java.net/hsx/hsx23/hotspot/rev/a5f2ffa62a17
|
|
|
EVALUATION
http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/a735aec54ea4
|
|
|
EVALUATION
http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a735aec54ea4
|
|
|
SUGGESTED FIX
Integrated into hs24/b04 changset:
http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a735aec54ea4
|
|
|
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 {
|
|
|
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.
|
|
|
|