RFR: 8338883: Show warning when CreateCoredumpOnCrash set, but core dump will not happen [v12]

David Holmes dholmes at openjdk.org
Wed Oct 2 01:09:43 UTC 2024


On Mon, 30 Sep 2024 20:05:12 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> We add a small feature, which prints a warning if user explicitly requests `CreateCoredumpOnCrash`, but it's disabled on the os level.
>> 
>> This behavior is the same as other VM features that can be turned on by runtime flags, but are unavailable. For example we show `"UseCRC32 specified, but not supported on this CPU"` if `UseCRC32` is set, but unavailable.
>> 
>> Example of output:
>> 
>> 
>> # ulimit -c 0                                                         
>> # ./build/xcode/build/jdk/bin/java -XX:+CreateCoredumpOnCrash -version
>> OpenJDK 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
>> openjdk version "24-internal" 2025-03-18
>> OpenJDK Runtime Environment (build 24-internal-adhoc.gerard.jdk)
>> OpenJDK 64-Bit Server VM (build 24-internal-adhoc.gerard.jdk, mixed mode, sharing)
>> 
>> # ulimit -c 1024                                                      
>> # ./build/xcode/build/jdk/bin/java -XX:+CreateCoredumpOnCrash -version
>> OpenJDK 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but /cores/core.66547 (max size 512 k). To ensure a full core dump, try "ulimit -c unlimited" before starting Java again
>> openjdk version "24-internal" 2025-03-18
>> OpenJDK Runtime Environment (build 24-internal-adhoc.gerard.jdk)
>> OpenJDK 64-Bit Server VM (build 24-internal-adhoc.gerard.jdk, mixed mode, sharing)
>> 
>> # ulimit -c unlimited
>> # ./build/xcode/build/jdk/bin/java -XX:+CreateCoredumpOnCrash -version
>> openjdk version "24-internal" 2025-03-18
>> OpenJDK Runtime Environment (build 24-internal-adhoc.gerard.jdk)
>> OpenJDK 64-Bit Server VM (build 24-internal-adhoc.gerard.jdk, mixed mode, sharing)
>> 
>> 
>> 
>> 
>> 
>> Testing:
>> - passes `"MACH5 runtime/ErrorHandling/CreateCoredumpOnCrash.java"`
>> - full MACH5 test in progress...
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   clear warning on Win

Overall looks good.

A few nits.

Thanks

src/hotspot/os/windows/os_windows.cpp line 1322:

> 1320:         }
> 1321:       } else {
> 1322:         // For now on Windows, there is no more checks that we can do

Suggestion:

        // For now on Windows, there are no more checks that we can do.

test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java line 1:

> 1: /*

Java code indent is 4 not 2 - please reformat.

test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java line 39:

> 37: import jdk.internal.misc.Unsafe;
> 38: 
> 39: import java.lang.Runtime;

This is not needed

test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java line 79:

> 77:         oa.shouldNotHaveExitValue(0);
> 78: 
> 79:         // Do "ulimit -c 0" last, as once we decrease it, we cannot increase it

But you are running each test in a new shell.

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20734#pullrequestreview-2341688405
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1783688027
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1783719114
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1783694357
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1783726878


More information about the hotspot-runtime-dev mailing list