JDK-8206243 : java -XshowSettings fails if memory.limit_in_bytes overflows LONG.max
  • Type: Bug
  • Component: core-svc
  • Affected Version: 11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-07-03
  • Updated: 2021-05-20
  • Resolved: 2018-07-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 Other
11 b22Fixed 12Fixed openjdk8u302Fixed
Related Reports
Relates :  
Description
On some Linux kernels, the unlimited value of memory.limit_in_bytes is returned as ULONG_MAX, not LONG_MAX.

- .../nightly $ cat //sys/fs/cgroup/memory/memory.limit_in_bytes
18446744073709551615

In those cases, java -XshowSettings will fail:

java -XshowSettings
....
Operating System Metrics:
    Provider: cgroupv1
    Effective CPU Count: 8
    CPU Period: 100000us
    CPU Quota: -1
    CPU Shares: -1
    List of Processors, 8 total:
    0 1 2 3 4 5 6 7
    List of Effective Processors, 0 total:
        List of Memory Nodes, 1 total:
    0
    List of Available Memory Nodes, 0 total:
        CPUSet Memory Pressure Enabled: false
Exception in thread "main" java.lang.NumberFormatException: For input string: "18446744073709551615"
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.base/java.lang.Long.parseLong(Long.java:692)
        at java.base/java.lang.Long.parseLong(Long.java:817)
        at java.base/jdk.internal.platform.cgroupv1.SubSystem.getLongValue(SubSystem.java:106)
        at java.base/jdk.internal.platform.cgroupv1.Metrics.getMemoryLimit(Metrics.java:374)
        at java.base/sun.launcher.LauncherHelper.printSystemMetrics(LauncherHelper.java:385)
        at java.base/sun.launcher.LauncherHelper.showSettings(LauncherHelper.java:180)

Comments
RFR (8u) I'd like to backport this fix to jdk8u to solve the issue with jtreg startup on a platform with Unlimited memory limit. The patch doesn't apply cleanly due to recent updates of the file. Review thread http://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-May/013879.html, reviewed by Severin Gehwolf
20-05-2021