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