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

    https://github.com/apache/spark/pull/21356#discussion_r189350251
  
    --- Diff: core/src/main/scala/org/apache/spark/util/ListenerBus.scala ---
    @@ -80,6 +89,11 @@ private[spark] trait ListenerBus[L <: AnyRef, E] extends 
Logging {
           }
           try {
             doPostEvent(listener, event)
    +        if (Thread.interrupted()) {
    --- End diff --
    
    This is ok right now since Spark code never explicitly interrupts these 
threads. If we ever need to do that, though, this might become a problem... but 
in that case I don't know how you'd handle this issue without just giving up 
and stopping everything.
    
    But... is this correct? Your test just calls `Thread.interrupt()`, which 
just sets the interrupt flag. But what if the listener calls an operation that 
would actually turn that into an `InterrruptedException`? You're not catching 
that here anywhere.
    
    ```
    scala> Thread.currentThread().interrupt()
    
    scala> Thread.sleep(10)
    java.lang.InterruptedException: sleep interrupted
      at java.lang.Thread.sleep(Native Method)
      ... 33 elided
    ```



---

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

Reply via email to