Skip to content
Snippets Groups Projects
Commit c1840a86 authored by Marcelo Vanzin's avatar Marcelo Vanzin
Browse files

[SPARK-7736] [CORE] Fix a race introduced in PythonRunner.

The fix for SPARK-7736 introduced a race where a port value of "-1"
could be passed down to the pyspark process, causing it to fail to
connect back to the JVM. This change adds code to fix that race.

Author: Marcelo Vanzin <vanzin@cloudera.com>

Closes #8258 from vanzin/SPARK-7736.
parent 354f4582
No related branches found
No related tags found
No related merge requests found
......@@ -52,10 +52,16 @@ object PythonRunner {
gatewayServer.start()
}
})
thread.setName("py4j-gateway")
thread.setName("py4j-gateway-init")
thread.setDaemon(true)
thread.start()
// Wait until the gateway server has started, so that we know which port is it bound to.
// `gatewayServer.start()` will start a new thread and run the server code there, after
// initializing the socket, so the thread started above will end as soon as the server is
// ready to serve connections.
thread.join()
// Build up a PYTHONPATH that includes the Spark assembly JAR (where this class is), the
// python directories in SPARK_HOME (if set), and any files in the pyFiles argument
val pathElements = new ArrayBuffer[String]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment