Browse Source

Fall back to naive parallel forks calculation in non-standard cases (#85410)

Some architectures provide non-standard output in /proc/cpuinfo.
Specifically, AWS graviton. In case we can't properly calculate physical
cpu cores via the standard method just fallback to using the JDK-backed
implementation.
Mark Vieira 3 years ago
parent
commit
216c774451

+ 4 - 1
build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/info/ParallelDetector.java

@@ -75,9 +75,12 @@ public class ParallelDetector {
                 });
 
                 _defaultParallel = Integer.parseInt(stdout.toString().trim());
-            } else {
+            }
+
+            if (_defaultParallel == null || _defaultParallel < 1) {
                 _defaultParallel = Runtime.getRuntime().availableProcessors() / 2;
             }
+
         }
 
         return Math.min(_defaultParallel, project.getGradle().getStartParameter().getMaxWorkerCount());