 +            val workerEnv = pb.environment()
 +            workerEnv.putAll(envVars.asJava)
 +            workerEnv.put("PYTHONPATH", pythonPath)
-+            // This is equivalent to setting the -u flag; we use it because ipython doesn't support -u:
++            // This is equivalent to setting the -u flag;
++            // we use it because ipython doesn't support -u:
 +            workerEnv.put("PYTHONUNBUFFERED", "YES")
 +            workerEnv.put("PYTHON_WORKER_FACTORY_PORT", manageServerSocket.getLocalPort.toString)
 +            workerEnv.put("PYTHON_WORKER_FACTORY_SECRET", authHelper.secret)


       // Redirect worker stdout and stderr
-      redirectStreamsToStderr(worker.getInputStream, worker.getErrorStream)
+      //redirectStreamsToStderr(worker.getInputStream, worker.getErrorStream)
+        // Redirect worker stdout and stderr

       // Wait for it to connect to our socket, and validate the auth secret.
-      serverSocket.setSoTimeout(10000)
+      //serverSocket.setSoTimeout(10000)
+        // Wait for it to connect to our socket, and validate the auth secret.

+        /*
       try {
         val socket = serverSocket.accept()
         authHelper.authClient(socket)
@@ -185,7 +254,27 @@ private[spark] class PythonWorkerFactory(pythonExec: String, envVars: Map[String
       if (serverSocket != null) {
         serverSocket.close()
       }
+    }*/
+        try {
+          val socket = serverSocket.accept()
+          val port = socket.getLocalPort


 private[spark] object BarrierTaskContextMessageProtocol {
diff --git a/core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala b/core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala
index df236ba892..03e274f4bb 100644
--- a/core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala
+++ b/core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala
@@ -17,7 +17,7 @@
