浏览代码

HDFS-1836. Thousand of CLOSE_WAIT socket. Contributed by Todd Lipcon, ported to security branch by Bharath Mundlapudi.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1135859 13f79535-47bb-0310-9956-ffa450edef68
Matthew Foley 14 年之前
父节点
当前提交
4f7765a93a
共有 2 个文件被更改,包括 14 次插入14 次删除
  1. 11 2
      CHANGES.txt
  2. 3 12
      src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

+ 11 - 2
CHANGES.txt

@@ -2,8 +2,17 @@ Hadoop Change Log
 
 
 Release 0.20.206.0 - unreleased
 Release 0.20.206.0 - unreleased
 
 
-  MAPREDUCE-7343. Make the number of warnings accepted by test-patch
-  configurable to limit false positives. (Thomas Graves via cdouglas)
+  NEW FEATURES
+
+  BUG FIXES
+
+  IMPROVEMENTS
+
+    MAPREDUCE-7343. Make the number of warnings accepted by test-patch
+    configurable to limit false positives. (Thomas Graves via cdouglas)
+
+    HDFS-1836. Thousand of CLOSE_WAIT socket. Contributed by Todd Lipcon,
+    ported to security branch by Bharath Mundlapudi. (via mattf)
 
 
 Release 0.20.205.0 - unreleased
 Release 0.20.205.0 - unreleased
 
 

+ 3 - 12
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

@@ -2526,11 +2526,7 @@ public class DFSClient implements FSConstants, java.io.Closeable {
             }
             }
 
 
             synchronized (dataQueue) {
             synchronized (dataQueue) {
-              try {
-                blockStream.close();
-                blockReplyStream.close();
-              } catch (IOException e) {
-              }
+              IOUtils.cleanup(LOG, blockStream, blockReplyStream);
               nodes = null;
               nodes = null;
               response = null;
               response = null;
               blockStream = null;
               blockStream = null;
@@ -2670,11 +2666,7 @@ public class DFSClient implements FSConstants, java.io.Closeable {
       }
       }
 
 
       if (blockStream != null) {
       if (blockStream != null) {
-        try {
-          blockStream.close();
-          blockReplyStream.close();
-        } catch (IOException e) {
-        }
+        IOUtils.cleanup(LOG, blockStream, blockReplyStream);
       }
       }
       blockStream = null;
       blockStream = null;
       blockReplyStream = null;
       blockReplyStream = null;
@@ -3417,8 +3409,7 @@ public class DFSClient implements FSConstants, java.io.Closeable {
         synchronized (dataQueue) {
         synchronized (dataQueue) {
           if (blockStream != null) {
           if (blockStream != null) {
             blockStream.writeInt(0); // indicate end-of-block to datanode
             blockStream.writeInt(0); // indicate end-of-block to datanode
-            blockStream.close();
-            blockReplyStream.close();
+            IOUtils.cleanup(LOG, blockStream, blockReplyStream);
           }
           }
           if (s != null) {
           if (s != null) {
             s.close();
             s.close();