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
1 changed files with 8 additions and 8 deletions

View File

@ -1315,7 +1315,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
// 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 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
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 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
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 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
ApplicationAttemptStateData.newInstance(
applicationAttemptId, getMasterContainer(),
rmStore.getCredentialsFromAppAttempt(this),
startTime, stateToBeStored, finalTrackingUrl, diags,
startTime, stateToBeStored, finalTrackingUrl, diags.toString(),
finalStatus, exitStatus,
getFinishTime(), resUsage.getMemorySeconds(),
resUsage.getVcoreSeconds(),