Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SPARK-1609: Executor fails to start when Command.extraJavaOptions contains multiple Java options #547

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ object CommandUtils extends Logging {
def buildJavaOpts(command: Command, memory: Int, sparkHome: String): Seq[String] = {
val memoryOpts = Seq(s"-Xms${memory}M", s"-Xmx${memory}M")
// Note, this will coalesce multiple options into a single command component
val extraOpts = command.extraJavaOptions.toSeq
val extraOpts = command.extraJavaOptions.map(Utils.splitCommandString).getOrElse(Seq())

val libraryOpts =
if (command.libraryPathEntries.size > 0) {
val joined = command.libraryPathEntries.mkString(File.pathSeparator)
Expand All @@ -62,10 +63,10 @@ object CommandUtils extends Logging {
val classPath = Utils.executeAndGetOutput(
Seq(sparkHome + "/bin/compute-classpath" + ext),
extraEnvironment=command.environment)
val userClassPath = command.classPathEntries.mkString(File.pathSeparator)
val classPathWithUser = classPath + File.pathSeparator + userClassPath
val userClassPath = command.classPathEntries ++ Seq(classPath)

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

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