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

    https://github.com/apache/spark/pull/541#discussion_r11976049
  
    --- Diff: core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala 
---
    @@ -110,13 +110,35 @@ private[spark] class PythonRDD[T: ClassTag](
           }
         }.start()
     
    +    // Necessary to distinguish between a task that has failed and a task 
that is finished
    +    @volatile var success: Boolean = false
    +
    +    // It is necessary to have a monitor thread for python workers if the 
user cancel's with
    +    // interrupts disabled. In that case we will need to explicitly kill 
the worker, otherwise the
    +    // threads can block indefinetly.
    +    new Thread(s"Worker Monitor for $pythonExec") {
    +      override def run() {
    +        // Kill the worker if it is interrupted or completed
    +        // When a python task completes, the context is always set to 
interupted
    +        while (!context.interrupted) {
    +          Thread.sleep(2000)
    +        }
    +        if (!success) {
    +          Try(env.destroyPythonWorker(pythonExec, envVars.toMap))
    --- End diff --
    
    Shouldn't we print something if destroying it fails? Is it possible that it 
crashed by itself? I would log something here saying "success was false, we're 
going to try to kill this worker"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to