From f7014c473c97f9130ba9de801fdab78fd664c1a3 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Wed, 22 Jan 2014 22:35:13 +0000 Subject: [PATCH] HDFS-5806. Balancer should set soTimeout to avoid indefinite hangs. Contributed by Nathan Roberts. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1560549 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/hdfs/server/balancer/Balancer.java | 1 + 2 files changed, 4 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index c395bff788b..b26f1ac364b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -295,6 +295,9 @@ Release 2.4.0 - UNRELEASED HDFS-5748. Too much information shown in the dfs health page. (Haohui Mai via brandonli) + HDFS-5806. Balancer should set SoTimeout to avoid indefinite hangs. + (Nathan Roberts via Andrew Wang) + BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS HDFS-4985. Add storage type to the protocol and expose it in block report diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java index 95260d5c74d..f8cdb1ec4e5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java @@ -337,6 +337,7 @@ public class Balancer { sock.connect( NetUtils.createSocketAddr(target.datanode.getXferAddr()), HdfsServerConstants.READ_TIMEOUT); + sock.setSoTimeout(HdfsServerConstants.READ_TIMEOUT); sock.setKeepAlive(true); OutputStream unbufOut = sock.getOutputStream();