Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247863

Unreachable code in OperatingSystemImpl.getTotalSwapSpaceSize()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 15, 16
    • Fix Version/s: 16
    • Component/s: core-svc
    • Labels:
      None
    • Environment:

      Docker

      Description

      During review of JDK-8244500 it was discovered that with the new cgroups implementation supporting v1 and v2 Metrics.getMemoryAndSwapLimit() will never return 0 when relevant cgroup files are missing. E.g. on a system where the kernel doesn't support swap limit capabilities. Therefore this code introduced with JDK-8236617 can no longer be reached and should get removed:

                   if (limit >= 0 && memLimit >= 0) {
      - return limit - memLimit;
      + // we see a limit == 0 on some machines where "kernel does not support swap limit capabilities"
      + return (limit < memLimit) ? 0 : limit - memLimit;
                   }

      More details here:
      http://mail.openjdk.java.net/pipermail/hotspot-dev/2020-June/042167.html

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sgehwolf Severin Gehwolf
              Reporter:
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: