From e74631f0ca6c5a7d2b5973f6679a429b985f83ce Mon Sep 17 00:00:00 2001 From: Bosko Devetak Date: Tue, 7 Aug 2018 13:54:00 +0000 Subject: [PATCH] Close the scanner leak in rest server when using the limit number of rows. Example: when using uri's like /sometable/*?limit=5&startrow=eGlND&endrow=eGlNE where the scan range has more rows than the limit, the rest server will start leaking memmory. --- .../src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java index 05bb0d6a05..77552a6f8e 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java @@ -98,6 +98,9 @@ public class TableScanResource extends ResourceBase { kv.getTimestamp(), CellUtil.cloneValue(kv))); } count--; + if (count == 0) { + results.close(); + } return rModel; } }; -- 2.11.0