HBASE-12274 Race between RegionScannerImpl#nextInternal() and RegionScannerImpl#close() may produce null pointer exception
This commit is contained in:
parent
7c87f9c6b5
commit
686e77108a
|
@ -4108,6 +4108,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
|
||||
|
|
|
@ -2164,9 +2164,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);
|
||||
|
|
Loading…
Reference in New Issue