RFR: JDK-8306507: [linux] Print number of memory mappings in error reports [v2]

Severin Gehwolf sgehwolf at openjdk.org
Mon May 22 10:09:54 UTC 2023


On Thu, 27 Apr 2023 12:18:30 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> The number of active mappings of a crashed JVM is interesting in case of an OOM, but counting mappings is cumbersome, especially when dealing with very large processes. /proc/pid/maps can have millions of lines.
>> 
>> Let's print out the number of active mappings when hs-err printing.
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into JDK-8306507-Print-number-of-memory-mappings-in-error-reports
>  - JDK-8306507-Print-number-of-memory-mappings-in-error-reports

Looks fine. Up to you to take the suggestion or not.

src/hotspot/os/linux/os_linux.cpp line 1850:

> 1848:     st->print_cr("Can not get library information for pid = %d", pid);
> 1849:   }
> 1850:   st->print_cr("Total number of mappings: %u", num);

Should we only print the number of mappings if  `_print_ascii_file` returns `true`? I.e. to avoid the hypothetical output of:


Can not get library information for pid = <pid>
Total number of mappings: 0


How about?


 unsigned num = 0;
  if (!_print_ascii_file(fname, st, &num)) {
    st->print_cr("Can not get library information for pid = %d", pid);
  } else {
    st->print_cr("Total number of mappings: %u", num);
  }

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

Marked as reviewed by sgehwolf (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13555#pullrequestreview-1436273812
PR Review Comment: https://git.openjdk.org/jdk/pull/13555#discussion_r1200291512


More information about the hotspot-runtime-dev mailing list