Author: jdcryans
Date: Wed Dec 30 07:36:15 2009
New Revision: 894552

URL: http://svn.apache.org/viewvc?rev=894552&view=rev
Log:
HBASE-2077  NullPointerException with an open scanner that expired causing 
            an immediate region server shutdown (Sam Pullara via JD)

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/Leases.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=894552&r1=894551&r2=894552&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Wed Dec 30 07:36:15 2009
@@ -30,6 +30,8 @@
                at the same time
    HBASE-2026  NPE in StoreScanner on compaction
    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-1961  HBase EC2 scripts

Modified: 
hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/Leases.java
URL: 
http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/Leases.java?rev=894552&r1=894551&r2=894552&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/Leases.java 
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/Leases.java Wed 
Dec 30 07:36:15 2009
@@ -183,11 +183,13 @@
   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);
     }


Reply via email to