Skip to content

Reset topology-refresh in-progress flag on synchronous exception - #3817

Merged
a-TODO-rov merged 1 commit into
redis:mainfrom
karunsehwag:fix/topology-refresh-inprogress-flag
Jul 3, 2026
Merged

a-TODO-rov merged 1 commit into
redis:mainfrom
karunsehwag:fix/topology-refresh-inprogress-flag

Conversation

@karunsehwag

@karunsehwag karunsehwag commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

ClusterTopologyRefreshTask only cleared its in-progress flag inside the whenComplete callback of the reload stage.

If reloadTopologyAsync.get() throws synchronously before returning a stage, the catch block logs the error but leaves the flag set. That can cause later topology refresh attempts to be skipped because the in-progress guard remains true.

This change resets the flag in the synchronous exception path as well.

Added a unit test that verifies:

  • refreshPartitionsAsync() throws synchronously
  • the in-progress flag is reset afterward
  • a second run can start another refresh attempt

Fixes #3730


Note

Low Risk
Small, localized fix to error handling in cluster topology refresh with a matching unit test; no auth or data-path changes.

Overview
Fixes a bug where cluster topology refresh could get stuck if refreshPartitionsAsync() failed before returning a CompletionStage.

ClusterTopologyRefreshTask only cleared its in-progress guard in whenComplete. A synchronous throw from reloadTopologyAsync.get() was logged but left the flag set, so later refreshes were skipped with “already in progress.”

The catch path now calls set(false) so the guard matches async failure handling. A unit test asserts the flag clears after a sync throw and a second run() can call refreshPartitionsAsync() again.

Reviewed by Cursor Bugbot for commit b1b09d0. Bugbot is set up for automated code reviews on this repo. Configure here.

ClusterTopologyRefreshTask only cleared its in-progress flag inside the
whenComplete callback of the reload stage. If reloadTopologyAsync.get()
threw synchronously instead of returning a stage, the catch block logged
the error but left the flag set, permanently disabling further topology
refreshes for the client.
@jit-ci

jit-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@a-TODO-rov
a-TODO-rov merged commit a663060 into redis:main Jul 3, 2026
13 checks passed
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.

shutDownAsync is not truly async in

2 participants

⌂ 换网址