Index: src/java/org/apache/hadoop/hbase/Leases.java =================================================================== --- src/java/org/apache/hadoop/hbase/Leases.java (revision 755878) +++ src/java/org/apache/hadoop/hbase/Leases.java Tue Dec 29 23:14:10 PST 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); }