WeichenXu123 edited a comment on issue #25235: [WIP][SPARK-28483][Core] Fix 
canceling a spark job using barrier mode but barrier tasks do not exit
URL: https://github.com/apache/spark/pull/25235#issuecomment-514520895
 
 
   The reason I do not use `thread.interrupt` to cancel the thread is:
   * In spark framework, when `Task.kill(interruptThread: Boolean, reason: 
String)` being called, the `interruptThread` flag is sometimes `false` which do 
not allow us to interrupt the task thread.
   * Even if we can interrupt the task thread, the scala `Future` do not 
support `thread.interrupt`, i.e. the `Future.await` will still block until 
timeout and ignore the interrupt signal.
   
   So that in task thread function, we always have to poll the task interrupt 
flag and if interrupted, then throw exception to terminate the thread by itself.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to