peter-toth commented on code in PR #58714:
URL: https://github.com/apache/spark/pull/58714#discussion_r4542600116


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterSchedulerBackend.scala:
##########
@@ -76,8 +76,9 @@ private[spark] class KubernetesClusterSchedulerBackend(
 
   private[k8s] def doRemoveExecutor(executorId: String, reason: 
ExecutorLossReason): Unit = {
     removeExecutor(executorId, reason)
-    podAllocator match {
-      case allocator: ExecutorPodsAllocator if reason.message.contains("OOM") 
=>
+    (podAllocator, reason) match {
+      case (allocator: ExecutorPodsAllocator, exited: ExecutorExited)
+          if exited.exitCausedByApp && exited.isOutOfMemoryError =>

Review Comment:
   **Finding 1.** Exit code 52 already turned recovery mode on, because its 
message carries `52(JVM OOM)`. The case that changes is exit code 137. On 
master its message carries `137(SIGKILL, possible container OOM)`, so any 137 
exit of a pod that wasn't deleted turns recovery mode on. With this PR, only an 
executor container that reports `OOMKilled` does.
   
   `docs/running-on-kubernetes.md:654-656` documents the master behavior and 
names 137 as an example trigger. The PR doesn't update it, and 
`docs/core-migration-guide.md` has no note either. The SPARK-55639 test that 
pinned the old behavior now asserts `never()`. Since 4.2 the driver turns 
recovery mode on by itself. So this applies to every Kubernetes application, 
also with `spark.scheduler.oomRetry.enabled` off.
   
   The OOM retry policy doesn't need this change. I'd keep `doRemoveExecutor` 
as it is on master. The narrowing could go to its own ticket together with the 
doc update. If it stays here, the doc has to describe the new rule and the 
migration guide needs a note.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to