diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManager.java index fac084c0fc8..00d8c15e418 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManager.java @@ -83,7 +83,8 @@ public class MemoryUsageEstimationProcessManager { onProcessCrash(jobId, processHolder)); processHolder.process = process; if (process.isProcessAlive() == false) { - String errorMsg = new ParameterizedMessage("[{}] Error while starting process", jobId).getFormattedMessage(); + String errorMsg = + new ParameterizedMessage("[{}] Error while starting process: {}", jobId, process.readError()).getFormattedMessage(); throw ExceptionsHelper.serverError(errorMsg); } try { diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManagerTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManagerTests.java index 82532ca430f..5a647c8178b 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManagerTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/process/MemoryUsageEstimationProcessManagerTests.java @@ -95,6 +95,7 @@ public class MemoryUsageEstimationProcessManagerTests extends ESTestCase { public void testRunJob_ProcessNotAlive() { when(process.isProcessAlive()).thenReturn(false); + when(process.readError()).thenReturn("Error from inside the process"); processManager.runJobAsync(TASK_ID, dataFrameAnalyticsConfig, dataExtractorFactory, listener); @@ -103,8 +104,10 @@ public class MemoryUsageEstimationProcessManagerTests extends ESTestCase { assertThat(exception.status(), equalTo(RestStatus.INTERNAL_SERVER_ERROR)); assertThat(exception.getMessage(), containsString(TASK_ID)); assertThat(exception.getMessage(), containsString("Error while starting process")); + assertThat(exception.getMessage(), containsString("Error from inside the process")); verify(process).isProcessAlive(); + verify(process).readError(); verifyNoMoreInteractions(process, listener); }