Skip to content

Commit d1508dd

Browse files
Marcelo VanzinAndrew Or
authored andcommitted
[SPARK-12386][CORE] Fix NPE when spark.executor.port is set.
Author: Marcelo Vanzin <[email protected]> Closes #10339 from vanzin/SPARK-12386.
1 parent fdb3822 commit d1508dd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/main/scala/org/apache/spark/SparkEnv.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,12 @@ object SparkEnv extends Logging {
256256
if (rpcEnv.isInstanceOf[AkkaRpcEnv]) {
257257
rpcEnv.asInstanceOf[AkkaRpcEnv].actorSystem
258258
} else {
259-
val actorSystemPort = if (port == 0) 0 else rpcEnv.address.port + 1
259+
val actorSystemPort =
260+
if (port == 0 || rpcEnv.address == null) {
261+
port
262+
} else {
263+
rpcEnv.address.port + 1
264+
}
260265
// Create a ActorSystem for legacy codes
261266
AkkaUtils.createActorSystem(
262267
actorSystemName + "ActorSystem",

0 commit comments

Comments
 (0)