YARN-7511. NPE in ContainerLocalizer when localization failed for running container. Contributed by Tao Yang
This commit is contained in:
parent
55669515f6
commit
83798f15f8
@ -136,6 +136,10 @@ public Set<String> resourceLocalized(LocalResourceRequest request,
|
||||
}
|
||||
|
||||
public void resourceLocalizationFailed(LocalResourceRequest request) {
|
||||
// Skip null request when localization failed for running container
|
||||
if (request == null) {
|
||||
return;
|
||||
}
|
||||
pendingResources.remove(request);
|
||||
resourcesFailedToBeLocalized.add(request);
|
||||
}
|
||||
|
@ -524,6 +524,27 @@ public void testDockerContainerLocalizationFailureAtDone() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLocalizationFailureWhileRunning()
|
||||
throws Exception {
|
||||
WrappedContainer wc = null;
|
||||
try {
|
||||
wc = new WrappedContainer(6, 314159265358979L, 4344, "yak");
|
||||
wc.initContainer();
|
||||
wc.localizeResources();
|
||||
wc.launchContainer();
|
||||
reset(wc.localizerBus);
|
||||
assertEquals(ContainerState.RUNNING, wc.c.getContainerState());
|
||||
// Now in RUNNING, handle ContainerResourceFailedEvent, cause NPE before
|
||||
wc.handleContainerResourceFailedEvent();
|
||||
} finally {
|
||||
if (wc != null) {
|
||||
wc.finished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked") // mocked generic
|
||||
public void testCleanupOnKillRequest() throws Exception {
|
||||
@ -1400,6 +1421,11 @@ public void resourceFailedContainer() {
|
||||
drainDispatcherEvents();
|
||||
}
|
||||
|
||||
public void handleContainerResourceFailedEvent() {
|
||||
c.handle(new ContainerResourceFailedEvent(cId, null, null));
|
||||
drainDispatcherEvents();
|
||||
}
|
||||
|
||||
// Localize resources
|
||||
// Skip some resources so as to consider them failed
|
||||
public Map<Path, List<String>> doLocalizeResources(
|
||||
|
Loading…
Reference in New Issue
Block a user