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 19:35:50 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 6af5255b0 -> afc76eb21


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/afc76eb2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/afc76eb2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/afc76eb2

Branch: refs/heads/branch-2.8
Commit: afc76eb2187aa3f5fb7ab468a55c3a56c2c8becf
Parents: 6af5255
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: Thu Dec 3 11:35:29 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/afc76eb2/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/afc76eb2/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 0231f93..6951832 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -1658,6 +1658,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