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

    https://github.com/apache/spark/pull/15505#discussion_r89889108
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -247,28 +248,29 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val rpcEnv: Rp
         // Launch tasks returned by a set of resource offers
         private def launchTasks(tasks: Seq[Seq[TaskDescription]]) {
           for (task <- tasks.flatten) {
    -        val serializedTask = ser.serialize(task)
    -        if (serializedTask.limit >= maxRpcMessageSize) {
    -          scheduler.taskIdToTaskSetManager.get(task.taskId).foreach { 
taskSetMgr =>
    -            try {
    +        try {
    +          val serializedTask = task.encode(ser)
    +          if (serializedTask.limit >= maxRpcMessageSize) {
    +            scheduler.taskIdToTaskSetManager.get(task.taskId).foreach { 
taskSetMgr =>
                   var msg = "Serialized task %s:%d was %d bytes, which exceeds 
max allowed: " +
                     "spark.rpc.message.maxSize (%d bytes). Consider increasing 
" +
                     "spark.rpc.message.maxSize or using broadcast variables 
for large values."
                   msg = msg.format(task.taskId, task.index, 
serializedTask.limit, maxRpcMessageSize)
                   taskSetMgr.abort(msg)
    -            } catch {
    -              case e: Exception => logError("Exception in error callback", 
e)
                 }
    +          } else {
    +            val executorData = executorDataMap(task.executorId)
    +            executorData.freeCores -= scheduler.CPUS_PER_TASK
    +            logDebug(s"Launching task ${task.taskId} on executor id: 
${task.executorId} " +
    +              s" hostname: ${executorData.executorHost}.")
    +            executorData.executorEndpoint.send(LaunchTask(new 
SerializableBuffer(serializedTask)))
               }
    -        }
    -        else {
    -          val executorData = executorDataMap(task.executorId)
    -          executorData.freeCores -= scheduler.CPUS_PER_TASK
    -
    -          logDebug(s"Launching task ${task.taskId} on executor id: 
${task.executorId} hostname: " +
    -            s"${executorData.executorHost}.")
    -
    -          executorData.executorEndpoint.send(LaunchTask(new 
SerializableBuffer(serializedTask)))
    +        } catch {
    +          case NonFatal(e) =>
    +            scheduler.taskIdToTaskSetManager.get(task.taskId).foreach { 
taskSetMgr =>
    +              val message = s"Failed to serialize task ${task.taskId}, not 
attempting to retry it."
    +              taskSetMgr.abort(message, Some(e))
    --- End diff --
    
    Can you localize the exception catching, so move this catch part to right 
above the "task.encode" line (252), and then catch a different exception after 
calling taskSetMgr.abort (like the old code had)?  (since taskSetMgr.abort is 
wrapped in a try/catch in the old code, it doesn't look like something that 
should be called in the catch statement)


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to