Put error message from inside the process into the exception that is thrown when the process doesn't start correctly. (#45846) (#45875)
This commit is contained in:
parent
ba6d72ea9f
commit
2ed19b2c81
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue