anishshri-db commented on code in PR #52318:
URL: https://github.com/apache/spark/pull/52318#discussion_r2342421783


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/python/streaming/TransformWithStateInPySparkStateServer.scala:
##########
@@ -172,15 +172,32 @@ class TransformWithStateInPySparkStateServer(
           logWarning(log"No more data to read from the socket")
           
statefulProcessorHandle.setHandleState(StatefulProcessorHandleState.CLOSED)
           return
-        case _: InterruptedException =>
+        case _: InterruptedException | _: InterruptedIOException |
+             _: ClosedByInterruptException =>
+          // InterruptedIOException - thrown when an I/O operation is 
interrupted
+          // ClosedByInterruptException - thrown when an I/O operation upon a 
channel is interrupted
           logInfo(log"Thread interrupted, shutting down state server")
           Thread.currentThread().interrupt()
           
statefulProcessorHandle.setHandleState(StatefulProcessorHandleState.CLOSED)
           return
         case e: Exception =>
           logError(log"Error reading message: ${MDC(LogKeys.ERROR, 
e.getMessage)}", e)
-          sendResponse(1, e.getMessage)
-          outputStream.flush()
+          try {
+            sendResponse(1, e.getMessage)
+            outputStream.flush()
+          } catch {
+            // InterruptedIOException - thrown when an I/O operation is 
interrupted
+            // ClosedByInterruptException - thrown when an I/O operation upon a
+            //                              channel is interrupted
+            case _: InterruptedException | _: InterruptedIOException |
+                 _: ClosedByInterruptException =>
+              logInfo(log"Thread is interrupted during flushing error 
response, " +
+                              "shutting down state server")

Review Comment:
   nit: indent seems off ?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to