Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/143#discussion_r14319569
  
    --- Diff: core/src/main/scala/org/apache/spark/util/ClosureCleaner.scala ---
    @@ -153,6 +153,18 @@ private[spark] object ClosureCleaner extends Logging {
           field.setAccessible(true)
           field.set(func, outer)
         }
    +    
    +    if (checkSerializable) {
    +      ensureSerializable(func)
    +    }
    +  }
    +
    +  private def ensureSerializable(func: AnyRef) {
    +    try {
    +      SparkEnv.get.closureSerializer.newInstance().serialize(func)
    +    } catch {
    +      case ex: Exception => throw new SparkException("Task not 
serializable: " + ex.toString)
    --- End diff --
    
    would this be better?
    ```scala
    throw new SparkException("Task not serializable", ex)
    ```


---
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.
---

Reply via email to