From 36788d1cc258e56f48df68e706db36db53eb484b Mon Sep 17 00:00:00 2001 From: Jonathan Hsieh Date: Thu, 26 Jan 2012 23:30:47 +0000 Subject: [PATCH] HBASE-5282 Possible file handle leak with truncated HLog file git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1236445 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/hbase/regionserver/HRegion.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 75959b5061b..1d12bd1fb59 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -2739,8 +2739,9 @@ public class HRegion implements HeapSize { // , Writable{ MonitoredTask status = TaskMonitor.get().createStatus(msg); status.setStatus("Opening logs"); - HLog.Reader reader = HLog.getReader(this.fs, edits, conf); + HLog.Reader reader = null; try { + reader = HLog.getReader(this.fs, edits, conf); long currentEditSeqId = minSeqId; long firstSeqIdInLog = -1; long skippedEdits = 0; @@ -2871,8 +2872,10 @@ public class HRegion implements HeapSize { // , Writable{ LOG.debug(msg); return currentEditSeqId; } finally { - reader.close(); status.cleanup(); + if (reader != null) { + reader.close(); + } } }