RFR: 8338883: Add core dump info to -Xlog:os=info [v6]

David Holmes dholmes at openjdk.org
Mon Sep 16 00:59:18 UTC 2024


On Sat, 14 Sep 2024 00:22:22 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> We add a small feature, which adds core dump info, which till now was only printed as part of hs_err log file, directly to stdout, when desired using log mechanism, i.e. `-Xlog:os=info`
>> 
>> For example, if we see:
>> 
>> `core dump info: core.28283`
>> 
>> we know all is set up correctly and we can expect a core file if java process crashes. If we see:
>> 
>> `core dump info: Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again`
>> 
>> instead, however, we know that "ulimit -c unlimited" needs to be set.
>> 
>> 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:
> 
>   use warning to show when core dump is not going to happen

I find the Posix code very confusing now with unnecessary statements and checks.

src/hotspot/os/posix/os_posix.cpp line 117:

> 115:       if (!check_only) {
> 116:         // TODO: why is this true for general case?
> 117:         will_dump_core = true;

It is already true.

src/hotspot/os/posix/os_posix.cpp line 122:

> 120:     } else if (core_path[0] == '"') { // redirect to user process
> 121:       jio_snprintf(buffer, bufferSize, "Core dumps may be processed with %s", core_path);
> 122:       will_dump_core = true;

It is already true.

src/hotspot/os/posix/os_posix.cpp line 130:

> 128:         if (!check_only) {
> 129:           // TODO: why is this true for general case?
> 130:           will_dump_core = true;

It is already true.

src/hotspot/os/posix/os_posix.cpp line 136:

> 134:           case RLIM_INFINITY:
> 135:             jio_snprintf(buffer, bufferSize, "%s", core_path);
> 136:             will_dump_core = true;

It is already true.

src/hotspot/os/posix/os_posix.cpp line 145:

> 143:             jio_snprintf(buffer, bufferSize, "%s (max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", core_path, uint64_t(rlim.rlim_cur) / K);
> 144:             if (!check_only) {
> 145:               will_dump_core = true;

It is already true.

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20734#pullrequestreview-2305658044
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1760425195
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1760425270
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1760425408
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1760425480
PR Review Comment: https://git.openjdk.org/jdk/pull/20734#discussion_r1760425586


More information about the hotspot-runtime-dev mailing list