parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject parquet-mr git commit: PARQUET-571: Fix potential leak in ParquetFileReader.close()
Date Fri, 25 Mar 2016 19:19:57 GMT
Repository: parquet-mr
Updated Branches:
  refs/heads/master 4b1ff8f4b -> e9928c94c


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/e9928c94
Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/e9928c94
Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/e9928c94

Branch: refs/heads/master
Commit: e9928c94ce1385ec72028336417f19f30ac38ac0
Parents: 4b1ff8f
Author: Nezih Yigitbasi <nyigitbasi@netflix.com>
Authored: Fri Mar 25 12:19:39 2016 -0700
Committer: Daniel Weeks <dweeks@apache.org>
Committed: Fri Mar 25 12:19:39 2016 -0700

----------------------------------------------------------------------
 .../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/e9928c94/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 3d7b499..7ac1706 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
@@ -776,11 +776,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