Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-9476

VMStats processCpuTime, fdLimit, and fdsOpen will always be zero on java 16 and later

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.15.0
    • statistics

    Description

      VMStats processCpuTime, fdLimit, and fdsOpen will always be zero on java 16 and later.
      This is because it calls Method.setAccessible which is not allowed under normal conditions starting with java 16 (see: https://softwaregarden.dev/en/posts/new-java/illegal-access-in-java-16).

      A workaround for this bug is to start the jvm with --illegal-access=permit

      The setAccessible call is in the static initializer for: org.apache.geode.internal.stats50.VMStats50

      It turns out the following works for calling processCpuTime:

              OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
              com.sun.management.OperatingSystemMXBean sunBean = (com.sun.management.OperatingSystemMXBean) osBean;
              System.out.println("getProcessCpuTime=" + sunBean.getProcessCpuTime());
      

      so we can get rid of the setAccessible call

      Attachments

        Activity

          People

            Unassigned Unassigned
            dschneider Darrel Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: