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

David Holmes dholmes at openjdk.org
Wed Oct 16 00:56:15 UTC 2024


On Mon, 7 Oct 2024 21:35:53 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 `gtest runtime/ErrorHandling/CreateCoredumpOnCrash.java`
>> - passes MACH5 tier1,tier2,tier3,tier4,tier5
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   final tweaks

Approving but there is the possibility of finessing the test logic if you choose.

Thanks

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

> 30:  *          jdk.internal.jvmstat/sun.jvmstat.monitor
> 31:  * @run driver CreateCoredumpOnCrash
> 32:  * @requires vm.flagless

Not sure it matters but it is customary to put the requires before any actions like build/run/compile

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

> 65:         } else {
> 66:             String exec_cmd[] = {"sh", "-c", "ulimit -c"};
> 67:             OutputAnalyzer oa = new OutputAnalyzer(Runtime.getRuntime().exec(exec_cmd));

You could use `ProcessTools.executeProcess("sh", "-c", "ulimit -c");`

For that matter there are related utilities in ./lib/jdk/test/lib/util/CoreUtils.java - but maybe not worth trying to adapt to current needs.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20734#pullrequestreview-2370906960
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1802159986
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1802167378


More information about the hotspot-runtime-dev mailing list