From 61382ff8fabc76b3a51f227646573cdf367fea1a Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Thu, 28 Jan 2016 18:59:35 +0000 Subject: [PATCH] YARN-4643. Container recovery is broken with delegating container runtime. Contributed by Sidharta Seethana --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../launcher/RecoveredContainerLaunch.java | 7 ++++--- .../server/nodemanager/TestLinuxContainerExecutor.java | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index c8a8c060c7f..1b57a3dedef 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -1345,6 +1345,9 @@ Release 2.8.0 - UNRELEASED YARN-4520. Finished app info is unnecessarily persisted in NM state-store if container is acquired but not lunched on this node. (sandflee via jianeh) + YARN-4643. Container recovery is broken with delegating container runtime + (Sidharta Seethana via jlowe) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/RecoveredContainerLaunch.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/RecoveredContainerLaunch.java index d7b9ae28cd6..66f5a2a6a5e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/RecoveredContainerLaunch.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/RecoveredContainerLaunch.java @@ -83,9 +83,10 @@ public class RecoveredContainerLaunch extends ContainerLaunch { exec.activateContainer(containerId, pidFilePath); retCode = exec.reacquireContainer( new ContainerReacquisitionContext.Builder() - .setUser(container.getUser()) - .setContainerId(containerId) - .build()); + .setContainer(container) + .setUser(container.getUser()) + .setContainerId(containerId) + .build()); } else { LOG.warn("Unable to locate pid file for container " + containerIdStr); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutor.java index 58debc91197..88ebf8dfcad 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutor.java @@ -629,7 +629,16 @@ public class TestLinuxContainerExecutor { } catch (IOException e) { // expected if LCE isn't setup right, but not necessary for this test } + + Container container = mock(Container.class); + ContainerLaunchContext context = mock(ContainerLaunchContext.class); + HashMap env = new HashMap<>(); + + when(container.getLaunchContext()).thenReturn(context); + when(context.getEnvironment()).thenReturn(env); + lce.reacquireContainer(new ContainerReacquisitionContext.Builder() + .setContainer(container) .setUser("foouser") .setContainerId(cid) .build());