rangadi commented on code in PR #42460:
URL: https://github.com/apache/spark/pull/42460#discussion_r1296652197


##########
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala:
##########
@@ -36,7 +36,7 @@ import org.apache.spark.util.{RedirectThread, Utils}
 
 case class PythonWorker(channel: SocketChannel, selector: Selector, 
selectionKey: SelectionKey) {
   def stop(): Unit = {
-    selectionKey.cancel()
+    Option(selectionKey).foreach(_.cancel())

Review Comment:
   @bogao007 this fixes NPE.
   cc: @utkarsh39 



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

To unsubscribe, e-mail: [email protected]

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