HBASE-12274 Race between RegionScannerImpl#nextInternal() and RegionScannerImpl#close() may produce null pointer exception

This commit is contained in:
Ted Yu 2014-10-17 16:04:02 +00:00
parent 5b3f6fb1a7
commit be820f3b9b
2 changed files with 8 additions and 1 deletions

View File

@ -4113,6 +4113,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
@Override
public boolean nextRaw(List<Cell> outResults, int limit) throws IOException {
if (storeHeap == null) {
// scanner is closed
throw new UnknownScannerException("Scanner was closed");
}
boolean returnResult;
if (outResults.isEmpty()) {
// Usually outResults is empty. This is true when next is called

View File

@ -2137,9 +2137,12 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
if (rsh != null) {
try {
RegionScanner scanner = rsh.s;
LOG.warn(scannerName + " encountered " + ie.getMessage() + ", closing ...");
scanner.close();
regionServer.leases.cancelLease(scannerName);
} catch (IOException e) {}
} catch (IOException e) {
LOG.warn("Getting exception closing " + scannerName, e);
}
}
}
throw new ServiceException(ie);