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

Gerard Ziemski gziemski at openjdk.org
Tue Sep 10 19:47:06 UTC 2024


On Tue, 10 Sep 2024 15:03:23 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:
> 
>   fix PATH_MAX on Windows, use check_only for record_coredump_status

> Proposal:
> 
> * if both `CreateCoredumpOnCrash`=1 _and_ it had been explicitly enabled at the command line, write an unconditional warning using the warning() function if it looks like core files would be prevented

The default for a new Ubuntu and macOS shell (via Terminal app) `ulimit core file size` is 0, ex:

Ubuntu Linux:


$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 63211
max locked memory           (kbytes, -l) 2032864
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 63211
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited


macOS:

# ulimit -a
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8176
-c: core file size (blocks)         0
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       6000
-n: file descriptors                256


so JVM would show a warning every time a user sets `CreateCoredumpOnCrash=true`.

I like the idea of a custom message, and I agree that putting it into `log` makes it harder to use, but are we sure we are OK with printing this in a warning (when explicitly requested, but system limit not set correctly)?

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

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


More information about the hotspot-runtime-dev mailing list