From 58039a7bc2882c334c4e673354e5cb1bce255f99 Mon Sep 17 00:00:00 2001 From: Jean-Daniel Cryans Date: Wed, 30 Dec 2009 07:38:02 +0000 Subject: [PATCH] HBASE-2077 NullPointerException with an open scanner that expired causing an immediate region server shutdown (Sam Pullara via JD) git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@894553 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ src/java/org/apache/hadoop/hbase/Leases.java | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4714705054b..bfa3e4e345d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -142,6 +142,8 @@ Release 0.21.0 - Unreleased HBASE-2026 NPE in StoreScanner on compaction HBASE-2072 fs.automatic.close isn't passed to FileSystem HBASE-2075 Master requires HDFS superuser privileges due to waitOnSafeMode + HBASE-2077 NullPointerException with an open scanner that expired causing + an immediate region server shutdown (Sam Pullara via JD) IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable diff --git a/src/java/org/apache/hadoop/hbase/Leases.java b/src/java/org/apache/hadoop/hbase/Leases.java index ad00864f97f..64f9bab8c64 100644 --- a/src/java/org/apache/hadoop/hbase/Leases.java +++ b/src/java/org/apache/hadoop/hbase/Leases.java @@ -183,11 +183,13 @@ public class Leases extends Thread { public void renewLease(final String leaseName) throws LeaseException { synchronized (leaseQueue) { Lease lease = leases.get(leaseName); - if (lease == null) { + // We need to check to see if the remove is successful as the poll in the run() + // method could have completed between the get and the remove which will result + // in a corrupt leaseQueue. + if (lease == null || !leaseQueue.remove(lease)) { throw new LeaseException("lease '" + leaseName + - "' does not exist"); + "' does not exist or has already expired"); } - leaseQueue.remove(lease); lease.setExpirationTime(System.currentTimeMillis() + leasePeriod); leaseQueue.add(lease); }