parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [18/50] [abbrv] parquet-mr git commit: PARQUET-571: Fix potential leak in ParquetFileReader.close()
Date Thu, 19 Jan 2017 01:27:29 GMT
PARQUET-571: Fix potential leak in ParquetFileReader.close()

If an exception occurs when closing the input stream `f`, the codecs
will not be released. This may cause native memory leaks for some codecs. \cc @rdblue

Author: Nezih Yigitbasi <nyigitbasi@netflix.com>

Closes #338 from nezihyigitbasi/leak-fix and squashes the following commits:

fcc5528 [Nezih Yigitbasi] Fix potential leak in close()


Project: http://git-wip-us.apache.org/repos/asf/parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-mr/commit/43d09617
Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/43d09617
Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/43d09617

Branch: refs/heads/parquet-1.8.x
Commit: 43d0961705c7757018439a3d54cf213ec7b9dda2
Parents: a87c981
Author: Nezih Yigitbasi <nyigitbasi@netflix.com>
Authored: Fri Mar 25 12:19:39 2016 -0700
Committer: Ryan Blue <blue@apache.org>
Committed: Mon Jan 9 16:54:53 2017 -0800

----------------------------------------------------------------------
 .../org/apache/parquet/hadoop/ParquetFileReader.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/43d09617/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
index 2d579b4..3c4c6fc 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
@@ -753,11 +753,14 @@ public class ParquetFileReader implements Closeable {
 
   @Override
   public void close() throws IOException {
-    if (f != null) {
-      f.close();
-    }
-    if (codecFactory != null) {
-      codecFactory.release();
+    try {
+      if (f != null) {
+        f.close();
+      }
+    } finally {
+      if (codecFactory != null) {
+        codecFactory.release();
+      }
     }
   }
 


Mime
View raw message