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

Runtime.getRuntime().availableProcessors() returns wrong value

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      Java version "1.8.0_141"
      Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Red Hat Enterprise Linux Server release 6.9 (Santiago)
      Linux myhost 2.6.32-696.10.1.el6.x86_64 #1 SMP x86_64 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      CGroups Configured

      A DESCRIPTION OF THE PROBLEM :
      version of JRE 1.8.0_141.b15 still has has the bug below
      https://bugs.openjdk.java.net/browse/JDK-6515172

      Even though per the ticket, it should have been resolved in JRE 1.8.0_141.b01 but still there

      Here is the code that was used to test the issue
      public class Processors{
       public static void main(String []args) {
         System.out.println("Available Processors: "+Runtime.getRuntime().availableProcessors());
       }
      }

      We have 4 core processor

      Here are the execution results of above code on hrdvijh0401d
      $ ./jre1.8.0_141_bpr32-x86_64/bin/java -cp . Processors
      Available Processors: 1
      $ ./jre1.8.0_141-x86_64/bin/java -cp . Processors
      Available Processors: 1
      $ ./jre1.8.0_101-x86_64/bin/java -cp . Processors
      Available Processors: 4



      REGRESSION. Last worked in version 8u131

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Here is the code that was used to test the issue
      public class Processors{
       public static void main(String []args) {
         System.out.println("Available Processors: "+Runtime.getRuntime().availableProcessors());
       }
      }

      We have 4 core processor

      Here are the execution results of above code on hrdvijh0401d
      $ ./jre1.8.0_141_bpr32-x86_64/bin/java -cp . Processors
      Available Processors: 1
      $ ./jre1.8.0_141-x86_64/bin/java -cp . Processors
      Available Processors: 1
      $ ./jre1.8.0_101-x86_64/bin/java -cp . Processors
      Available Processors: 4


      REPRODUCIBILITY :
      This bug can be reproduced always.

            fmatte Fairoz Matte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: