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

    https://github.com/apache/spark/pull/15505#discussion_r98537808
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -243,27 +245,42 @@ 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 = TaskDescription.encode(task)
    -        if (serializedTask.limit >= maxRpcMessageSize) {
    -          scheduler.taskIdToTaskSetManager.get(task.taskId).foreach { 
taskSetMgr =>
    -            try {
    -              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)
    -            }
    +      val serializedTasks = tasks.flatten.map { task =>
    +        var serializedTask: ByteBuffer = null
    +        try {
    +          serializedTask = TaskDescription.encode(task, 
task.serializedTask)
    +          if (serializedTask.limit >= maxRpcMessageSize) {
    +            val 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."
    +            abortTaskSetManager(scheduler, task.taskId,
    +              msg.format(task.taskId, task.index, serializedTask.limit, 
maxRpcMessageSize))
    +            serializedTask = null
    +          } else if (serializedTask.limit > 
TaskSetManager.TASK_SIZE_TO_WARN_KB * 1024) {
    +            
scheduler.taskIdToTaskSetManager.get(task.taskId).filterNot(_.emittedTaskSizeWarning).
    +              foreach { taskSetMgr =>
    +                taskSetMgr.emittedTaskSizeWarning = true
    +                val stageId = taskSetMgr.taskSet.stageId
    +                logWarning(s"Stage $stageId contains a task of very large 
size " +
    +                  s"(${serializedTask.limit / 1024} KB). The maximum 
recommended task size is " +
    +                  s"${TaskSetManager.TASK_SIZE_TO_WARN_KB} KB.")
    +              }
               }
    +        } catch {
    +          case NonFatal(e) =>
    +            abortTaskSetManager(scheduler, task.taskId,
    +              s"Failed to serialize task ${task.taskId}, not attempting to 
retry it.", Some(e))
             }
    -        else {
    +        (task, serializedTask)
    +      }
    +
    +      if (!serializedTasks.exists(b => b._2 eq null)) {
    --- End diff --
    
    I think the problem @squito mentioned still exists here: if launchTasks is 
called for task 1 in task set 1 and task 2 in task set 2, and task 1 fails to 
serialize?  It seems like then task set 1 will be aborted, but task 2 won't be 
launched for task set 2, because this if-statement will evaluate to false?


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