vyommani opened a new pull request, #832:
URL: https://github.com/apache/ranger/pull/832

   The PolicyRefresher.stopRefresher() method can deadlock because it 
interrupts the refresher thread and then waits for it to complete using join(). 
However, if the RangerRESTClient is currently in its retry loop due to server 
errors (such as 503 Service Unavailable), it catches the InterruptedException 
during its Thread.sleep() interval but fails to propagate the interruption 
signal or break the retry logic. By swallowing this exception, the client 
clears the thread's interrupted status and continues the for loop, preventing 
the thread from ever terminating. This leaves the calling thread blocked 
indefinitely on join().
   
   ## What changes were proposed in this pull request?
   
   The fix involves updating the shouldRetry() method in RangerRESTClient to 
properly handle the InterruptedException by restoring the thread's interrupted 
status via Thread.currentThread().interrupt() and returning false. This ensures 
that the retry loop is aborted immediately when a shutdown is requested, 
allowing the thread to exit gracefully and unblocking the stopRefresher() call 
without negatively impacting normal failover logic.
   
   
   ## How was this patch tested?
   
   New test added which fails without fix and passes after fix.
   


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

Reply via email to