RFR(xxs): 8206243: java -XshowSettings fails if memory.limit_in_bytes overflows LONG.max

Thomas Stüfe thomas.stuefe at gmail.com
Tue Jul 3 08:20:49 UTC 2018


Hi all,

may I please have reviews for this small fix.

https://bugs.openjdk.java.net/browse/JDK-8206243
http://cr.openjdk.java.net/~stuefe/webrevs/8206243-java-xshowsettings-fails-for-large-values-of-memory-limit_in_bytes/webrev.00/webrev/


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)


Thank you,

Thomas


More information about the serviceability-dev mailing list