From 378d62663fc7d1494747c806aa15cc482222ebe4 Mon Sep 17 00:00:00 2001 From: Junping Du Date: Sun, 5 Feb 2017 19:28:01 -0800 Subject: [PATCH] MAPREDUCE-6338. MR AppMaster does not honor ephemeral port range. Contributed by Frank Nguyen. (cherry picked from commit d401e63b6c3695d1f8f3f4958b8d592b15342b17) --- .../hadoop/mapred/TaskAttemptListenerImpl.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/TaskAttemptListenerImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/TaskAttemptListenerImpl.java index b68d86354d5..fe26ee5dd3f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/TaskAttemptListenerImpl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/TaskAttemptListenerImpl.java @@ -122,15 +122,14 @@ public class TaskAttemptListenerImpl extends CompositeService protected void startRpcServer() { Configuration conf = getConfig(); try { - server = - new RPC.Builder(conf).setProtocol(TaskUmbilicalProtocol.class) - .setInstance(this).setBindAddress("0.0.0.0") - .setPort(0).setNumHandlers( - conf.getInt(MRJobConfig.MR_AM_TASK_LISTENER_THREAD_COUNT, - MRJobConfig.DEFAULT_MR_AM_TASK_LISTENER_THREAD_COUNT)) - .setVerbose(false).setSecretManager(jobTokenSecretManager) - .build(); - + server = new RPC.Builder(conf).setProtocol(TaskUmbilicalProtocol.class) + .setInstance(this).setBindAddress("0.0.0.0") + .setPortRangeConfig(MRJobConfig.MR_AM_JOB_CLIENT_PORT_RANGE) + .setNumHandlers( + conf.getInt(MRJobConfig.MR_AM_TASK_LISTENER_THREAD_COUNT, + MRJobConfig.DEFAULT_MR_AM_TASK_LISTENER_THREAD_COUNT)) + .setVerbose(false).setSecretManager(jobTokenSecretManager).build(); + // Enable service authorization? if (conf.getBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,