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

Gerard Ziemski gziemski at openjdk.org
Wed Aug 28 20:04:33 UTC 2024


On Tue, 27 Aug 2024 20:42:48 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...

I was really surprised to learn that Windows version of `check_dump_limit()` actually creates the core dump file. Windows version also has nothing to do with checking for limits. The API is not aptly named.

Windows code/logic has many similarities to that of POSIX version: check for default flag, check OS to see if core dumps are possible (POSIX checks the rlimit, Windows checks for client version of the OS).

I took the opportunity to refactor/cleanup code a bit:
- made Windows implementation look more like POSIX
- shifted some code around in POSIX implementation to keep local variables in a tighter context
- split the code into checking vs preparation

What do you think?

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

PR Comment: https://git.openjdk.org/jdk/pull/20734#issuecomment-2316144664


More information about the hotspot-runtime-dev mailing list