YARN-6967. Limit application attempt's diagnostic message size thoroughly

(Contributed by Chengbing Liu via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-08-11 14:28:55 -07:00
parent c7680d4cc4
commit 65364defb4

View File

@ -1315,7 +1315,7 @@ private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
// AFTER the initial saving on app-attempt-start
// These fields can be visible from outside only after they are saved in
// StateStore
String diags = null;
BoundedAppender diags = new BoundedAppender(diagnostics.limit);
// don't leave the tracking URL pointing to a non-existent AM
if (conf.getBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED,
@ -1329,15 +1329,15 @@ private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
int exitStatus = ContainerExitStatus.INVALID;
switch (event.getType()) {
case LAUNCH_FAILED:
diags = event.getDiagnosticMsg();
diags.append(event.getDiagnosticMsg());
break;
case REGISTERED:
diags = getUnexpectedAMRegisteredDiagnostics();
diags.append(getUnexpectedAMRegisteredDiagnostics());
break;
case UNREGISTERED:
RMAppAttemptUnregistrationEvent unregisterEvent =
(RMAppAttemptUnregistrationEvent) event;
diags = unregisterEvent.getDiagnosticMsg();
diags.append(unregisterEvent.getDiagnosticMsg());
// reset finalTrackingUrl to url sent by am
finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
finalStatus = unregisterEvent.getFinalApplicationStatus();
@ -1345,16 +1345,16 @@ private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
case CONTAINER_FINISHED:
RMAppAttemptContainerFinishedEvent finishEvent =
(RMAppAttemptContainerFinishedEvent) event;
diags = getAMContainerCrashedDiagnostics(finishEvent);
diags.append(getAMContainerCrashedDiagnostics(finishEvent));
exitStatus = finishEvent.getContainerStatus().getExitStatus();
break;
case KILL:
break;
case FAIL:
diags = event.getDiagnosticMsg();
diags.append(event.getDiagnosticMsg());
break;
case EXPIRE:
diags = getAMExpiredDiagnostics(event);
diags.append(getAMExpiredDiagnostics(event));
break;
default:
break;
@ -1368,7 +1368,7 @@ private void rememberTargetTransitionsAndStoreState(RMAppAttemptEvent event,
ApplicationAttemptStateData.newInstance(
applicationAttemptId, getMasterContainer(),
rmStore.getCredentialsFromAppAttempt(this),
startTime, stateToBeStored, finalTrackingUrl, diags,
startTime, stateToBeStored, finalTrackingUrl, diags.toString(),
finalStatus, exitStatus,
getFinishTime(), resUsage.getMemorySeconds(),
resUsage.getVcoreSeconds(),