RFR: 8347833: CrashOnOutOfMemory should stop GC threads before HeapDumpOnOutOfMemoryError [v2]

Fairoz Matte fmatte at openjdk.org
Thu Feb 13 18:08:45 UTC 2025


On Tue, 11 Feb 2025 03:51:12 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Fairoz Matte has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Aditional work on review comments
>
> src/hotspot/share/utilities/vmError.cpp line 1952:
> 
>> 1950:   if(dumpHeap) {
>> 1951:     HeapDumper::dump_heap_from_oome();
>> 1952:   }
> 
> To be done at the same safepoint this code needs to be in `VM_ReportJavaOutOfMemory::doit()` - which is why the `dumpHeap` was to be passed to the `VM_ReportJavaOutOfMemory` constructor and stored in a field for `doit`.

I have modified this with my understanding, I need to fix the testcase to make sure, the operation happens in single safepoint

> test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryAndCrashOnOutOfMemory.java line 43:
> 
>> 41:             try {
>> 42:                 Object[] oa = new Object[Integer.MAX_VALUE];
>> 43:                 for(int i = 0; i < oa.length; i++) {
> 
> Suggestion:
> 
>                 for (int i = 0; i < oa.length; i++) {

done

> test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryAndCrashOnOutOfMemory.java line 44:
> 
>> 42:                 Object[] oa = new Object[Integer.MAX_VALUE];
>> 43:                 for(int i = 0; i < oa.length; i++) {
>> 44:                     oa[i] = new Object[Integer.MAX_VALUE];
> 
> This will throw the "VM limit reached" OOME - does that trigger the heapdump etc processing?

I have copied this code from TestHeapDumpOnOutOfMemoryError.java, and I have restricted heap to -Xmx128M to force OOM in heap.

> test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryAndCrashOnOutOfMemory.java line 57:
> 
>> 55:         OutputAnalyzer output = new OutputAnalyzer(pb.start());
>> 56:         int exitValue = output.getExitValue();
>> 57:         if(0 != exitValue) {
> 
> Suggestion:
> 
>         if (exitValue != 0) {

done

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1954989600
PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1954990360
PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1954992402
PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1954990027


More information about the hotspot-dev mailing list