Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/4021#discussion_r25215797 --- Diff: core/src/main/scala/org/apache/spark/Accumulators.scala --- @@ -320,7 +334,13 @@ private[spark] object Accumulators { def add(values: Map[Long, Any]): Unit = synchronized { for ((id, value) <- values) { if (originals.contains(id)) { - originals(id).asInstanceOf[Accumulable[Any, Any]] ++= value + // Since we are now storing weak references, we must check whether the underlying data + // is valid. + originals(id).get match { + case Some(accum) => accum.asInstanceOf[Accumulable[Any, Any]] ++= value + case None => + throw new IllegalAccessError("Attempted to access garbage collected Accumulator.") --- End diff -- The exception thrown here is caught at higher levels of the stack. For example, DAGScheduler wraps calls to accumulator methods in a `try` block and logs any uncaught exceptions. Have you run into a case where the current behavior causes a problem?
--- 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. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org