Skip to content

Commit a823661

Browse files
committed
Fix --die-on-broken-pipe not propagated properly
At the end of parsing options, we add an empty string to child arguments. This caused the arguments to py4j.JavaGateway to be interpreted as ["", "--die-on-broken-pipe", "0"].
1 parent 6fba412 commit a823661

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ object SparkSubmit {
128128
}
129129
if (args.primaryResource == PYSPARK_SHELL) {
130130
args.mainClass = "py4j.GatewayServer"
131-
args.childArgs ++= ArrayBuffer("--die-on-broken-pipe", "0")
131+
args.childArgs = ArrayBuffer("--die-on-broken-pipe", "0")
132132
} else {
133133
// If a python file is provided, add it to the child arguments and list of files to deploy.
134134
// Usage: PythonAppRunner <main python file> <extra python files> [app arguments]

core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ private[spark] class SparkSubmitArguments(args: Seq[String]) {
302302
parse(tail)
303303
}
304304
} else {
305-
childArgs += value
305+
if (!value.isEmpty) {
306+
childArgs += value
307+
}
306308
parse(tail)
307309
}
308310

0 commit comments

Comments
 (0)