You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2026/08/06 10:26:55 UTC

Re: [PR] [SPARK-58513][CORE] Init UnifiedMemoryManager should check driver config in driver , check executor config in executor [spark]

pan3793 commented on code in PR #57716:
URL: https://github.com/apache/spark/pull/57716#discussion_r3727979472


##########
core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala:
##########
@@ -459,12 +466,14 @@ object UnifiedMemoryManager extends Logging {
   /**
    * Return the total amount of memory shared between execution and storage, in bytes.
    */
-  private def getMaxMemory(conf: SparkConf): Long = {
+  private def getMaxMemory(conf: SparkConf, isDriver: Option[Boolean]): Long = {
     val systemMemory = conf.get(TEST_MEMORY)
     val reservedMemory = conf.getLong(TEST_RESERVED_MEMORY.key,
       if (conf.contains(IS_TESTING)) 0 else RESERVED_SYSTEM_MEMORY_BYTES)
     val minSystemMemory = (reservedMemory * 1.5).ceil.toLong
-    if (systemMemory < minSystemMemory) {
+    val checkDriverMemory = isDriver.isEmpty || isDriver.contains(true)
+    val checkExecutorMemory = isDriver.isEmpty || isDriver.contains(false)

Review Comment:
   This reverts the SPARK-12759 fail-fast: the driver no longer validates `spark.executor.memory` at `SparkContext` startup, so an undersized value now launches executors that all fail until the cluster manager gives up. The executor-memory check is cheap and correct on both roles; only the `INVALID_DRIVER_MEMORY` check needs gating:
   
   ```scala
   if (isDriver.getOrElse(true) && systemMemory < minSystemMemory) { ... }
   // SPARK-12759: keep unconditional
   if (conf.contains(config.EXECUTOR_MEMORY)) { ... }
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org