Github user tdas commented on a diff in the pull request: https://github.com/apache/spark/pull/126#discussion_r10533790 --- Diff: core/src/main/scala/org/apache/spark/Dependency.scala --- @@ -49,9 +49,28 @@ class ShuffleDependency[K, V]( @transient rdd: RDD[_ <: Product2[K, V]], val partitioner: Partitioner, val serializerClass: String = null) - extends Dependency(rdd.asInstanceOf[RDD[Product2[K, V]]]) { + extends Dependency(rdd.asInstanceOf[RDD[Product2[K, V]]]) with Logging { val shuffleId: Int = rdd.context.newShuffleId() + + override def finalize() { + try { + if (rdd != null) { + rdd.sparkContext.cleaner.cleanShuffle(shuffleId) + } + } catch { + case t: Throwable => + // Paranoia - If logError throws error as well, report to stderr. + try { + logError("Error in finalize", t) --- End diff -- Maybe it is a overkill. I am just trying to make sure that no exception gets propagated through the finalizing thread (i.e., the Java system thread that calls finalize on objects) and its probably best to not allow exceptions being thrown on that thread.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---