Skip to content

Commit 71f4d26

Browse files
witgopwendell
authored andcommitted
Fix SPARK-1609: Executor fails to start when Command.extraJavaOptions contains multiple Java options
Author: witgo <[email protected]> Closes #547 from witgo/SPARK-1609 and squashes the following commits: deb6a4c [witgo] review commit 91da0bb [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 0640852 [witgo] review commit 8f90b22 [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 bcf36cb [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 1185605 [witgo] fix extraJavaOptions split f7c0ab7 [witgo] bugfix 86fc4bb [witgo] bugfix 8a265b7 [witgo] Fix SPARK-1609: Executor fails to start when use spark-submit
1 parent 6b3c6e5 commit 71f4d26

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ object CommandUtils extends Logging {
4848
def buildJavaOpts(command: Command, memory: Int, sparkHome: String): Seq[String] = {
4949
val memoryOpts = Seq(s"-Xms${memory}M", s"-Xmx${memory}M")
5050
// Note, this will coalesce multiple options into a single command component
51-
val extraOpts = command.extraJavaOptions.toSeq
51+
val extraOpts = command.extraJavaOptions.map(Utils.splitCommandString).getOrElse(Seq())
52+
5253
val libraryOpts =
5354
if (command.libraryPathEntries.size > 0) {
5455
val joined = command.libraryPathEntries.mkString(File.pathSeparator)
@@ -62,10 +63,10 @@ object CommandUtils extends Logging {
6263
val classPath = Utils.executeAndGetOutput(
6364
Seq(sparkHome + "/bin/compute-classpath" + ext),
6465
extraEnvironment=command.environment)
65-
val userClassPath = command.classPathEntries.mkString(File.pathSeparator)
66-
val classPathWithUser = classPath + File.pathSeparator + userClassPath
66+
val userClassPath = command.classPathEntries ++ Seq(classPath)
6767

68-
Seq("-cp", classPathWithUser) ++ libraryOpts ++ extraOpts ++ memoryOpts
68+
Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++
69+
libraryOpts ++ extraOpts ++ memoryOpts
6970
}
7071

7172
/** Spawn a thread that will redirect a given stream to a file */

0 commit comments

Comments
 (0)