YARN-9197. Add safe guard against NPE for component instance failure.

Contributed by kyungwan nam
This commit is contained in:
Eric Yang 2019-01-18 13:49:56 -05:00
parent dacc1a759e
commit 8c7f6b2d4d

View File

@ -350,8 +350,10 @@ static void handleComponentInstanceRelaunch(ComponentInstance compInstance,
// record in ATS
LOG.info("Publishing component instance status {} {} ",
event.getContainerId(), containerState);
int exitStatus = failureBeforeLaunch || event.getStatus() == null ?
ContainerExitStatus.INVALID : event.getStatus().getExitStatus();
compInstance.serviceTimelinePublisher.componentInstanceFinished(
event.getContainerId(), event.getStatus().getExitStatus(),
event.getContainerId(), exitStatus,
containerState, containerDiag);
}
@ -366,8 +368,10 @@ static void handleComponentInstanceRelaunch(ComponentInstance compInstance,
if (compInstance.timelineServiceEnabled) {
// record in ATS
int exitStatus = failureBeforeLaunch || event.getStatus() == null ?
ContainerExitStatus.INVALID : event.getStatus().getExitStatus();
compInstance.serviceTimelinePublisher.componentInstanceFinished(
event.getContainerId(), event.getStatus().getExitStatus(),
event.getContainerId(), exitStatus,
containerState, containerDiag);
}