RFR: 8368551: Core dump warning may be confusing
Thomas Stuefe
stuefe at openjdk.org
Tue Nov 18 13:19:08 UTC 2025
On Thu, 6 Nov 2025 08:51:38 GMT, Paul Hübner <phubner at openjdk.org> wrote:
> Hi all,
>
> The `os::check_core_dump_prerequisites` function is used to build the strings of 1) warnings if `CreateCoredumpOnCrash` is specified explicitly and some prerequisite is not fulfilled (fully), and 2) the location of the dump when the VM aborts on error.
>
> This is fine for many cases, but there are some edgecases on POSIX systems where the warning makes little sense. For example, as reported in the issue:
>> OpenJDK 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but /shared/cores/core-%e-585191 (max size 0 k). To ensure a full core dump, try "ulimit -c unlimited" before starting Java again
>
> This PR refactors overhauls some of these edge cases to ensure that the warning messages and core locations are more clear and user-friendly.
>
> **Scenario 1: `CreateCoredumpOnCrash` is disabled**
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> # [...]
>> # CreateCoredumpOnCrash turned off, no core file dumped
>
> **Scenario 2: `get_core_path` errors**
>> Java HotSpot(TM) 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but core path is unknown, trying core.1552174 (may not exist)
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> # [...]
>> # Core dump will be written. Default location: core.1552174 (may not exist)
>
> **Scenario 3: the user processes core dump with e.g. `systemd-coredump`**
>> Java HotSpot(TM) 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %e" (or dumping to /home/opc/betterCoreMsg/core.1555400)
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> # [...]
>> # Core dump will be written. Default location: "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %e" (or dumping to /home/foo/bar/core.1555400)
>
> **Scenario 4: the resource limit for core dumps could not be determined**
>> Java HotSpot(TM) 64-Bit Server VM warning: CreateCoredumpOnCrash specified, but couldn't deduce rlim, trying /tmp/cores/core.%e.1560382.%h.%t (may not exist)
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> # [...]
>> # Core dump will be written. Default location: /tmp/cores/core.%e.1560382.%h.%t (may not exist)
>
> **Scenarios 5, 6, 7: ulimit of 0, 1024, and unlimited**
>> Java HotSpot(TM) 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
>> #
>> # A fatal er...
Thanks for taking this on. Some suggestions, but looks good overall.
src/hotspot/os/posix/os_posix.cpp line 111:
> 109: // Check core dump limit and report possible place where core can be found
> 110: void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) {
> 111: // We can wrap the buffer in a fixed stringStream, this won't free buffer once buf goes out of scope.
The comment is unnecessary; it is clear what happens
src/hotspot/os/posix/os_posix.cpp line 124:
> 122: // In the warning message, let the user know.
> 123: if (check_only) {
> 124: buf.print("core path is unknown, trying ");
The `trying` sounds weird. Who is trying what? It implies that the JVM attempts to try something, possibly suggesting to someone who doesn't know better that it polls the file system for a core file.
Pre-existing, I also wonder about `core.%d` - this is not so common a default that it used to be. AIX does not use it. The linux distributions I know have a different default, systemd-core or Debian's apport... Mac may use it, though `kern.core` allows for many variations. So, not sure.
I would be fine with a flat "cannot determine core location" and no more. But others may disagree. So not a strong opinion.
src/hotspot/os/posix/os_posix.cpp line 128:
> 126: buf.print("core.%d (may not exist)", current_process_id());
> 127: #ifdef LINUX
> 128: } else if (core_path[0] == '"') { // redirect to user process
Pre-existing, but the double quote is odd? Should this not be a pipe symbol? See `man core(5)`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28174#pullrequestreview-3477667069
PR Review Comment: https://git.openjdk.org/jdk/pull/28174#discussion_r2538065187
PR Review Comment: https://git.openjdk.org/jdk/pull/28174#discussion_r2538104587
PR Review Comment: https://git.openjdk.org/jdk/pull/28174#discussion_r2538115609
More information about the hotspot-runtime-dev
mailing list