Github user bersprockets commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20424#discussion_r168353782
  
    --- Diff: 
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala ---
    @@ -191,7 +192,29 @@ 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 _: EOFException =>
    +            throw new SparkException(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) {
    +          val exceptionMessage = f"""
    +               |Bad data in $daemonModule's standard output. Invalid port 
number:
    --- End diff --
    
    >Oh, I believe double spaces were actually a style nit just to be 
consistent.
    
    Oops, did I miss something?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to