This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new 3d22604 HBASE-22706 Backport HBASE-21292 to branch-1
3d22604 is described below
commit 3d226043a6768b3b4179f10d055e7ecd26a7d211
Author: Pankaj <[email protected]>
AuthorDate: Wed Jul 17 21:26:05 2019 +0530
HBASE-22706 Backport HBASE-21292 to branch-1
---
.../src/main/java/org/apache/hadoop/hbase/util/IdLock.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git
a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java
index fedf951..abd53d7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java
@@ -81,6 +81,17 @@ public class IdLock {
existing.wait();
} catch (InterruptedException e) {
--existing.numWaiters; // Remove ourselves from waiters.
+ // HBASE-21292/HBASE-22706
+ // There is a rare case that interrupting and the lock owner
thread call
+ // releaseLockEntry at the same time. Since the owner thread
found there
+ // still one waiting, it won't remove the entry from the map. If
the interrupted
+ // thread is the last one waiting on the lock, and since an
exception is thrown,
+ // the 'existing' entry will stay in the map forever. Later
threads which try to
+ // get this lock will stuck in a infinite loop because
+ // existing = map.putIfAbsent(entry.id, entry)) != null and
existing.isLocked=false.
+ if (!existing.isLocked && existing.numWaiters == 0) {
+ map.remove(existing.id);
+ }
throw new InterruptedIOException(
"Interrupted waiting to acquire sparse lock");
}