From ff89ec17c4f4be605cc9dd31fca18fd5ff2438cd Mon Sep 17 00:00:00 2001 From: Bosko Devetak Date: Tue, 7 Aug 2018 13:54:00 +0000 Subject: [PATCH] HBASE-21007 Memory leak in HBase REST server Close the scanner leak in rest server when using the limit number of rows. Example: when using uris 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. Signed-off-by: Andrew Purtell --- .../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 05bb0d6a050..8f5535e8760 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; } };