ueshin opened a new pull request #30242:
URL: https://github.com/apache/spark/pull/30242


   ### What changes were proposed in this pull request?
   
   This is a follow-up of #30177.
   
   Makes `TaskCompletion` event thread wait until the thread ends to avoid the 
race condition.
   
   ### Why are the changes needed?
   
   There are still sometimes crashes of executors as discussed at 
https://github.com/apache/spark/pull/30177#discussion_r513898999.
   
   The race condition could happen between `!context.isCompleted() && 
!context.isInterrupted()` and `iter.hasNext` in the `hasNext` method.
   This is because the `TaskCompletion` event thread could close the upstream 
iterator even between them.
   We should make the event wait for a while until the consuming thread ends 
which should end soon as the iterator returns `false` in `hasNext`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing tests.
   


----------------------------------------------------------------
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:
[email protected]



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

Reply via email to