Skip to content

Conversation

@vyommani
Copy link
Contributor

@vyommani vyommani commented Feb 1, 2026

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.

@vyommani
Copy link
Contributor Author

vyommani commented Feb 1, 2026

@mneethiraj , @pradeepagrawal8184 please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant