RamonZhou commented on code in PR #58396:
URL: https://github.com/apache/spark/pull/58396#discussion_r4331256562


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -2604,11 +2606,9 @@ def _delete_ml_cache(self, cache_ids: List[str], 
evict_only: bool = False) -> Li
             return []
 
     def _on_exit(self) -> None:
-        # If the client has already been explicitly closed, skip all cleanup 
RPCs.
-        # The server-side resources were released by close(); reissuing them 
here
-        # is wasted work and, if the server has since become unreachable, can
-        # block process exit on the gRPC call.
-        if self._closed:
+        # Skip cleanup RPCs if the session is already closed or released, or 
was never
+        # established. The server-side session ID may be "" rather than None.
+        if self._closed or self._session_released or not 
self._server_session_id:

Review Comment:
   Good catch! Fixed in the new commit



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