diff --git a/tony-core/src/main/java/com/linkedin/tony/TaskMonitor.java b/tony-core/src/main/java/com/linkedin/tony/TaskMonitor.java index e09edfce..c323a15d 100644 --- a/tony-core/src/main/java/com/linkedin/tony/TaskMonitor.java +++ b/tony-core/src/main/java/com/linkedin/tony/TaskMonitor.java @@ -107,6 +107,14 @@ private void refreshMetrics() { } private void refreshMemoryBytesMetrics() { + /** + * ProcfsBasedProcessTree currently is supported only on Linux. + * So when running test cases on Mac, the {@code resourceCalculator} + * is null and should be ignored. + */ + if (resourceCalculator == null) { + return; + } resourceCalculator.updateProcessTree(); double memoryBytes = resourceCalculator.getRssMemorySize(); setMaxMetrics(MAX_MEMORY_BYTES_INDEX, memoryBytes);