From 09ad8effb825eddbf0ee2ef591a0d16a58468f56 Mon Sep 17 00:00:00 2001 From: Jitendra Pandey Date: Thu, 16 Mar 2017 11:40:12 -0700 Subject: [PATCH] HDFS-11533. reuseAddress option should be used for child channels in Portmap and SimpleTcpServer. Contributed by Mukul Kumar Singh. --- .../src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java | 1 + .../src/main/java/org/apache/hadoop/portmap/Portmap.java | 1 + 2 files changed, 2 insertions(+) diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java index f7ab52e3d5..bd48b15858 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java @@ -81,6 +81,7 @@ public ChannelPipeline getPipeline() throws Exception { }); server.setOption("child.tcpNoDelay", true); server.setOption("child.keepAlive", true); + server.setOption("child.reuseAddress", true); server.setOption("reuseAddress", true); // Listen to TCP port diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java index 94d76d08fd..7586fdad67 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java @@ -110,6 +110,7 @@ public ChannelPipeline getPipeline() throws Exception { } }); tcpServer.setOption("reuseAddress", true); + tcpServer.setOption("child.reuseAddress", true); udpServer = new ConnectionlessBootstrap(new NioDatagramChannelFactory( Executors.newCachedThreadPool()));