YARN-4152. NodeManager crash with NPE when LogAggregationService#stopContainer called for absent container. (Bibin A Chundatt via rohithsharmaks)
This commit is contained in:
parent
3d8f6b9d48
commit
ace4d26936
|
@ -819,6 +819,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-4188. Make MoveApplicationAcrossQueues abstract, newInstance static.
|
YARN-4188. Make MoveApplicationAcrossQueues abstract, newInstance static.
|
||||||
(Giovanni Matteo Fumarola via cdouglas)
|
(Giovanni Matteo Fumarola via cdouglas)
|
||||||
|
|
||||||
|
YARN-4152. NodeManager crash with NPE when LogAggregationService#stopContainer called for
|
||||||
|
absent container. (Bibin A Chundatt via rohithsharmaks)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -56,6 +56,7 @@ import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
|
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType;
|
||||||
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.LogHandler;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.LogHandler;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent;
|
||||||
|
@ -423,8 +424,14 @@ public class LogAggregationService extends AbstractService implements
|
||||||
+ ", did it fail to start?");
|
+ ", did it fail to start?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ContainerType containerType = context.getContainers().get(
|
Container container = context.getContainers().get(containerId);
|
||||||
containerId).getContainerTokenIdentifier().getContainerType();
|
if (null == container) {
|
||||||
|
LOG.warn("Log aggregation cannot be started for " + containerId
|
||||||
|
+ ", as its an absent container");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ContainerType containerType =
|
||||||
|
container.getContainerTokenIdentifier().getContainerType();
|
||||||
aggregator.startContainerLogAggregation(
|
aggregator.startContainerLogAggregation(
|
||||||
new ContainerLogContext(containerId, containerType, exitCode));
|
new ContainerLogContext(containerId, containerType, exitCode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1509,6 +1509,25 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
|
||||||
verifyLogAggFinishEvent(appId);
|
verifyLogAggFinishEvent(appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout = 50000)
|
||||||
|
public void testLogAggregationAbsentContainer() throws Exception {
|
||||||
|
ApplicationId appId = createApplication();
|
||||||
|
LogAggregationService logAggregationService =
|
||||||
|
createLogAggregationService(appId,
|
||||||
|
FailedOrKilledContainerLogAggregationPolicy.class, null);
|
||||||
|
ApplicationAttemptId appAttemptId1 =
|
||||||
|
BuilderUtils.newApplicationAttemptId(appId, 1);
|
||||||
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId1, 2l);
|
||||||
|
try {
|
||||||
|
logAggregationService.handle(new LogHandlerContainerFinishedEvent(
|
||||||
|
containerId, 100));
|
||||||
|
assertTrue("Should skip when null containerID", true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Assert.assertFalse("Exception not expected should skip null containerid",
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test (timeout = 50000)
|
@Test (timeout = 50000)
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testAMOnlyContainerPolicy() throws Exception {
|
public void testAMOnlyContainerPolicy() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue