You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2015/05/08 23:00:54 UTC

spark git commit: [SPARK-7490] [CORE] [Minor] MapOutputTracker.deserializeMapStatuses: close input streams

Repository: spark
Updated Branches:
  refs/heads/master 4b3bb0e43 -> 25889d8d9


[SPARK-7490] [CORE] [Minor] MapOutputTracker.deserializeMapStatuses: close input streams

GZIPInputStream allocates native memory that is not freed until close() or
when the finalizer runs. It is best to close() these streams explicitly.

stephenh made the same change for serializeMapStatuses in commit b0d884f0. This is the same change for deserialize.

(I ran the unit test suite! it seems to have passed. I did not make a JIRA since this seems "trivial", and the guidelines suggest it is not required for trivial changes)

Author: Evan Jones <ej...@twitter.com>

Closes #5982 from evanj/master and squashes the following commits:

0d76e85 [Evan Jones] [CORE] MapOutputTracker.deserializeMapStatuses: close input streams


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/25889d8d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/25889d8d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/25889d8d

Branch: refs/heads/master
Commit: 25889d8d97094325f10fbf52f3b36412f212eeb2
Parents: 4b3bb0e
Author: Evan Jones <ej...@twitter.com>
Authored: Fri May 8 22:00:39 2015 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Fri May 8 22:00:39 2015 +0100

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/MapOutputTracker.scala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/25889d8d/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/MapOutputTracker.scala b/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
index 1607228..0184228 100644
--- a/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
+++ b/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
@@ -367,7 +367,11 @@ private[spark] object MapOutputTracker extends Logging {
   // Opposite of serializeMapStatuses.
   def deserializeMapStatuses(bytes: Array[Byte]): Array[MapStatus] = {
     val objIn = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(bytes)))
-    objIn.readObject().asInstanceOf[Array[MapStatus]]
+    Utils.tryWithSafeFinally {
+      objIn.readObject().asInstanceOf[Array[MapStatus]]
+    } {
+      objIn.close()
+    }
   }
 
   // Convert an array of MapStatuses to locations and sizes for a given reduce ID. If


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org