Skip to content

Commit 0089c7a

Browse files
committed
Throw an exception when spark.akka.frameSize > 2047
1 parent a217ec5 commit 0089c7a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/main/scala/org/apache/spark/util/AkkaUtils.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,16 @@ private[spark] object AkkaUtils extends Logging {
134134
Duration.create(conf.getLong("spark.akka.lookupTimeout", 30), "seconds")
135135
}
136136

137+
private val AKKA_MAX_FRAME_SIZE_IN_MB = Int.MaxValue / 1024 / 1024
138+
137139
/** Returns the configured max frame size for Akka messages in bytes. */
138140
def maxFrameSizeBytes(conf: SparkConf): Int = {
139-
conf.getInt("spark.akka.frameSize", 10) * 1024 * 1024
141+
val frameSizeInMB = conf.getInt("spark.akka.frameSize", 10)
142+
if (frameSizeInMB > AKKA_MAX_FRAME_SIZE_IN_MB) {
143+
throw new IllegalArgumentException("spark.akka.frameSize should not be greater than "
144+
+ AKKA_MAX_FRAME_SIZE_IN_MB + "MB")
145+
}
146+
frameSizeInMB * 1024 * 1024
140147
}
141148

142149
/** Space reserved for extra data in an Akka message besides serialized task or task result. */

0 commit comments

Comments
 (0)