hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject hadoop git commit: HDFS-9294. DFSClient deadlock when close file and failed to renew lease. Contributed by Brahma Reddy Battula
Date Thu, 03 Dec 2015 01:50:29 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 48cbde908 -> bac127a4e


HDFS-9294. DFSClient deadlock when close file and failed to renew lease.  Contributed by Brahma
Reddy Battula


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bac127a4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bac127a4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bac127a4

Branch: refs/heads/branch-2
Commit: bac127a4e2688f5c9364484f4ed6c603d29fbc34
Parents: 48cbde9
Author: Tsz-Wo Nicholas Sze <szetszwo@hortonworks.com>
Authored: Wed Dec 2 17:39:28 2015 -0800
Committer: Tsz-Wo Nicholas Sze <szetszwo@hortonworks.com>
Committed: Wed Dec 2 17:49:16 2015 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hdfs/DFSOutputStream.java | 28 ++++++++++++--------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 +++
 2 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bac127a4/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java
index f8e52b7..5878756 100755
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java
@@ -701,13 +701,17 @@ public class DFSOutputStream extends FSOutputSummer
    * Aborts this output stream and releases any system
    * resources associated with this stream.
    */
-  synchronized void abort() throws IOException {
-    if (isClosed()) {
-      return;
+  void abort() throws IOException {
+    synchronized (this) {
+      if (isClosed()) {
+        return;
+      }
+      getStreamer().getLastException().set(
+          new IOException("Lease timeout of "
+              + (dfsClient.getConf().getHdfsTimeout() / 1000)
+              + " seconds expired."));
+      closeThreads(true);
     }
-    getStreamer().getLastException().set(new IOException("Lease timeout of "
-        + (dfsClient.getConf().getHdfsTimeout() / 1000) + " seconds expired."));
-    closeThreads(true);
     dfsClient.endFileLease(fileId);
   }
 
@@ -740,11 +744,14 @@ public class DFSOutputStream extends FSOutputSummer
    * resources associated with this stream.
    */
   @Override
-  public synchronized void close() throws IOException {
-    try (TraceScope ignored =
-             dfsClient.newPathTraceScope("DFSOutputStream#close", src)) {
-      closeImpl();
+  public void close() throws IOException {
+    synchronized (this) {
+      try (TraceScope ignored = dfsClient.newPathTraceScope(
+          "DFSOutputStream#close", src)) {
+        closeImpl();
+      }
     }
+    dfsClient.endFileLease(fileId);
   }
 
   protected synchronized void closeImpl() throws IOException {
@@ -772,7 +779,6 @@ public class DFSOutputStream extends FSOutputSummer
                dfsClient.getTracer().newScope("completeFile")) {
         completeFile(lastBlock);
       }
-      dfsClient.endFileLease(fileId);
     } catch (ClosedChannelException ignored) {
     } finally {
       setClosed();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bac127a4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index f553b85..7a02bf6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -1670,6 +1670,9 @@ Release 2.7.2 - UNRELEASED
     HDFS-9426. Rollingupgrade finalization is not backward compatible
     (Kihwal Lee via vinayakumarb)
 
+    HDFS-9294. DFSClient deadlock when close file and failed to renew lease.
+    (Brahma Reddy Battula via szetszwo)
+
 Release 2.7.1 - 2015-07-06
 
   INCOMPATIBLE CHANGES


Mime
View raw message