You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2018/03/27 23:53:04 UTC

[1/3] hbase git commit: HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

Repository: hbase
Updated Branches:
  refs/heads/branch-2 a601c57f9 -> 6f1aa0edf
  refs/heads/branch-2.0 7251ab6f9 -> 163c8beeb
  refs/heads/master eb424ac5f -> 09ed7c7a1


HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

When prefetch on open is specified, there is a deadlocking case
where if the prefetch is cancelled, the PrefetchExecutor interrupts
the threads if necessary, when that happens in FileIOEngine, it
causes an ClosedByInterruptException which is a subclass of
ClosedChannelException. If we retry all ClosedChannelExceptions,
this will lock as this access is expected to be interrupted.
This change removes calling refreshFileConnections for
ClosedByInterruptExceptions.

Signed-off-by: Andrew Purtell <ap...@apache.org>


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

Branch: refs/heads/branch-2
Commit: 6f1aa0edff50d8a0a71c5011f0736e11f8986f98
Parents: a601c57
Author: Zach York <zy...@amazon.com>
Authored: Thu Mar 15 16:46:40 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Mar 27 16:52:59 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java     | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6f1aa0ed/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
index 648d4bc..29b810f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
+import java.nio.channels.ClosedByInterruptException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.util.Arrays;
@@ -229,6 +230,8 @@ public class FileIOEngine implements IOEngine {
       }
       try {
         accessLen = accessor.access(fileChannel, buffer, accessOffset);
+      } catch (ClosedByInterruptException e) {
+        throw e;
       } catch (ClosedChannelException e) {
         LOG.warn("Caught ClosedChannelException accessing BucketCache, reopening file. ", e);
         refreshFileConnection(accessFileNum);


[3/3] hbase git commit: HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

Posted by ap...@apache.org.
HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

When prefetch on open is specified, there is a deadlocking case
where if the prefetch is cancelled, the PrefetchExecutor interrupts
the threads if necessary, when that happens in FileIOEngine, it
causes an ClosedByInterruptException which is a subclass of
ClosedChannelException. If we retry all ClosedChannelExceptions,
this will lock as this access is expected to be interrupted.
This change removes calling refreshFileConnections for
ClosedByInterruptExceptions.

Signed-off-by: Andrew Purtell <ap...@apache.org>


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

Branch: refs/heads/master
Commit: 09ed7c7a1004df9fb98e58dd17eb07a479e427f9
Parents: eb424ac
Author: Zach York <zy...@amazon.com>
Authored: Thu Mar 15 16:46:40 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Mar 27 16:53:01 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java     | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/09ed7c7a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
index 648d4bc..29b810f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
+import java.nio.channels.ClosedByInterruptException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.util.Arrays;
@@ -229,6 +230,8 @@ public class FileIOEngine implements IOEngine {
       }
       try {
         accessLen = accessor.access(fileChannel, buffer, accessOffset);
+      } catch (ClosedByInterruptException e) {
+        throw e;
       } catch (ClosedChannelException e) {
         LOG.warn("Caught ClosedChannelException accessing BucketCache, reopening file. ", e);
         refreshFileConnection(accessFileNum);


[2/3] hbase git commit: HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

Posted by ap...@apache.org.
HBASE-20280 Fix possibility of deadlocking in refreshFileConnections

When prefetch on open is specified, there is a deadlocking case
where if the prefetch is cancelled, the PrefetchExecutor interrupts
the threads if necessary, when that happens in FileIOEngine, it
causes an ClosedByInterruptException which is a subclass of
ClosedChannelException. If we retry all ClosedChannelExceptions,
this will lock as this access is expected to be interrupted.
This change removes calling refreshFileConnections for
ClosedByInterruptExceptions.

Signed-off-by: Andrew Purtell <ap...@apache.org>


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

Branch: refs/heads/branch-2.0
Commit: 163c8beebae9d27be098b73ad30578cd1380b691
Parents: 7251ab6
Author: Zach York <zy...@amazon.com>
Authored: Thu Mar 15 16:46:40 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Mar 27 16:52:59 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java     | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/163c8bee/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
index 648d4bc..29b810f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileIOEngine.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
+import java.nio.channels.ClosedByInterruptException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.util.Arrays;
@@ -229,6 +230,8 @@ public class FileIOEngine implements IOEngine {
       }
       try {
         accessLen = accessor.access(fileChannel, buffer, accessOffset);
+      } catch (ClosedByInterruptException e) {
+        throw e;
       } catch (ClosedChannelException e) {
         LOG.warn("Caught ClosedChannelException accessing BucketCache, reopening file. ", e);
         refreshFileConnection(accessFileNum);