dtaniwaki commented on code in PR #56497:
URL: https://github.com/apache/spark/pull/56497#discussion_r3456807870


##########
python/pyspark/sql/connect/client/reattach.py:
##########
@@ -310,6 +339,19 @@ def _call_iter(self, iter_fun: Callable) -> Any:
                 )
                 self._iterator = None
                 raise RetryException() from e
+            elif (
+                e.code() == grpc.StatusCode.PERMISSION_DENIED
+                and not self._permission_denied_retried
+            ):
+                # Treat the first mid-stream PERMISSION_DENIED as a 
token-expiry signal; reattach
+                # once so the metadata provider can produce a fresh credential.
+                logger.debug(
+                    f"PERMISSION_DENIED on stream for operation 
{self._operation_id}; "
+                    f"allowing one reattach with refreshed metadata."
+                )
+                self._permission_denied_retried = True
+                self._iterator = None
+                raise RetryException() from e

Review Comment:
   @shrirangmhalgi @uros-b 
   I fixed the code to handle the infinite loop case. 
https://github.com/apache/spark/pull/56497/commits/ae19ecee0cd1261bdffd01a798920a06ccabf76d
   
   Could you review it again?



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