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

OperatingSystemMXBean should be made container aware

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11, 13, 14
    • Fix Version/s: 14
    • Component/s: core-svc

      Description

      When Java is running in a container many of the OperatingSystemMXBean accessor methods return host based information rather than container specific data.

      jdk/open/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java contains these native methods which extract Host specific data. These methods should be examine to determine if there is a container specific source of this information.

          private native long getCommittedVirtualMemorySize0();
          private native long getFreePhysicalMemorySize0();
          private native long getFreeSwapSpaceSize0();
          private native long getMaxFileDescriptorCount0();
          private native long getOpenFileDescriptorCount0();
          private native long getProcessCpuTime0();
          private native double getProcessCpuLoad0();
          private native double getSystemCpuLoad0();
          private native long getTotalPhysicalMemorySize0();
          private native long getTotalSwapSpaceSize0();

      These Java methods should first try to extract this information from the internal container Metrics API, if available. Otherwise it should call these existing native methods.

      Here are the Container Metrics implementation classes:

      jdk/open/src/java.base/share/classes/jdk/internal/platform/Container.java
      jdk/open/src/java.base/share/classes/jdk/internal/platform/Metrics.java

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sgehwolf Severin Gehwolf
                Reporter:
                bobv Bob Vandette
              • Votes:
                1 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: