Github user zhichao-li commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5280#discussion_r36637068
  
    --- Diff: core/src/main/scala/org/apache/spark/util/EventLoop.scala ---
    @@ -76,9 +76,21 @@ private[spark] abstract class EventLoop[E](name: String) 
extends Logging {
       def stop(): Unit = {
         if (stopped.compareAndSet(false, true)) {
           eventThread.interrupt()
    -      eventThread.join()
    -      // Call onStop after the event thread exits to make sure onReceive 
happens before onStop
    -      onStop()
    +      var onStopCalled = false
    +      try {
    +        eventThread.join()
    +        // Call onStop after the event thread exits to make sure onReceive 
happens before onStop
    +        onStopCalled = true
    +        onStop()
    +      } catch {
    +        case ie: InterruptedException =>
    +          Thread.currentThread().interrupt()
    +          if (!onStopCalled) {
    +            // ie is thrown from `eventThread.join()`. Otherwise, we 
should not call `onStop` since
    --- End diff --
    
    @zsxwing  Just go through the source code and stop here by accident. Seems 
like the unit test haven't cover the case that join() throw 
InterruptedException?  and how about move ` onStop()` to the finally block to 
ensure it would be executed in call cases.


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to