Github user bersprockets commented on a diff in the pull request: https://github.com/apache/spark/pull/20424#discussion_r164640285 --- Diff: core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala --- @@ -191,7 +191,20 @@ private[spark] class PythonWorkerFactory(pythonExec: String, envVars: Map[String daemon = pb.start() val in = new DataInputStream(daemon.getInputStream) - daemonPort = in.readInt() + try { + daemonPort = in.readInt() + } catch { + case exc: EOFException => + throw new IOException(s"No port number in $daemonModule's stdout") + } + + // test that the returned port number is within a valid range. + // note: this does not cover the case where the port number + // is arbitrary data but is also coincidentally within range + if (daemonPort < 1 || daemonPort > 0xffff) { + throw new IOException(s"Bad port number in $daemonModule's stdout: " + + f"0x$daemonPort%08x") --- End diff -- Yes, that makes sense. I might not be able to get it as clear as the exact path to the file, since the PythonWorkerFactory sets a PYTHONPATH environmental variable and then lets python itself figure out where on those paths the module actually lives. But I could tell the user how the PYTHONPATH was set up (in a generic sense, without using any shell's syntax) and then how the python command was subsequently run.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org