Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDCB118CEC for ; Thu, 3 Dec 2015 01:55:24 +0000 (UTC) Received: (qmail 6725 invoked by uid 500); 3 Dec 2015 01:55:24 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 6658 invoked by uid 500); 3 Dec 2015 01:55:24 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 6649 invoked by uid 99); 3 Dec 2015 01:55:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2015 01:55:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2CC12E67D2; Thu, 3 Dec 2015 01:55:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: szetszwo@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: HDFS-9294. DFSClient deadlock when close file and failed to renew lease. Contributed by Brahma Reddy Battula Date: Thu, 3 Dec 2015 01:55:24 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/branch-2.7 42a2bddcb -> 4123650e9 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/4123650e Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4123650e Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4123650e Branch: refs/heads/branch-2.7 Commit: 4123650e92c5b2fee121fb33c1ed62da010174ef Parents: 42a2bdd Author: Tsz-Wo Nicholas Sze Authored: Wed Dec 2 17:39:28 2015 -0800 Committer: Tsz-Wo Nicholas Sze Committed: Wed Dec 2 17:55:10 2015 -0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 ++ .../org/apache/hadoop/hdfs/DFSOutputStream.java | 32 +++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4123650e/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 6d902f3..074e779 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -123,6 +123,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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/4123650e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java index 3c8b2d3..e8080ee 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java @@ -2174,13 +2174,15 @@ 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; + } + streamer.setLastException(new IOException("Lease timeout of " + + (dfsClient.getHdfsTimeout() / 1000) + " seconds expired.")); + closeThreads(true); } - streamer.setLastException(new IOException("Lease timeout of " - + (dfsClient.getHdfsTimeout()/1000) + " seconds expired.")); - closeThreads(true); dfsClient.endFileLease(fileId); } @@ -2226,14 +2228,17 @@ public class DFSOutputStream extends FSOutputSummer * resources associated with this stream. */ @Override - public synchronized void close() throws IOException { - TraceScope scope = - dfsClient.getPathTraceScope("DFSOutputStream#close", src); - try { - closeImpl(); - } finally { - scope.close(); + public void close() throws IOException { + synchronized (this) { + TraceScope scope = dfsClient.getPathTraceScope("DFSOutputStream#close", + src); + try { + closeImpl(); + } finally { + scope.close(); + } } + dfsClient.endFileLease(fileId); } private synchronized void closeImpl() throws IOException { @@ -2268,7 +2273,6 @@ public class DFSOutputStream extends FSOutputSummer } finally { scope.close(); } - dfsClient.endFileLease(fileId); } catch (ClosedChannelException e) { } finally { setClosed();