Implement connection refresh on circular moved - #5893
Merged
Conversation
jduo
reviewed
May 21, 2026
jduo
reviewed
May 21, 2026
jduo
reviewed
May 21, 2026
jduo
approved these changes
May 25, 2026
Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
Extract shared is_circular_moved_redirect() function to detect when a MOVED redirect points to the same address (circular redirect). Apply this detection to both single command and pipeline paths. For pipelines, circular MOVED errors now route through the reconnect logic instead of the normal redirect logic, matching the behavior of single commands. Added test to verify pipeline commands recover from circular MOVED + disconnect scenarios. Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
… patch-updates group across 1 directory (#5910) chore(deps-dev): bump maturin Bumps the patch-updates group with 1 update in the /python directory: [maturin](https://github.com/pyo3/maturin). Updates `maturin` from 1.13.1 to 1.13.3 - [Release notes](https://github.com/pyo3/maturin/releases) - [Changelog](https://github.com/PyO3/maturin/blob/main/Changelog.md) - [Commits](PyO3/maturin@v1.13.1...v1.13.3) --- updated-dependencies: - dependency-name: maturin dependency-version: 1.13.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: patch-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
…lution - Add resolve_address parameter to is_circular_moved_redirect to handle cases where MOVED returns an IP but client connected via hostname - Fix resolve_address to preserve original port when resolving IP to hostname (the MOVED response port is authoritative) - Extend circular MOVED detection to pipeline path via handle_redirect_logic - Add unit tests for hostname vs IP detection scenarios - Add integration test for pipeline circular MOVED handling Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com>
alexr-bq
force-pushed
the
alexr/redirect-feature
branch
from
May 25, 2026 23:21
a7b13db to
a35ecfd
Compare
jamesx-improving
added a commit
that referenced
this pull request
May 26, 2026
* Implement connection refresh on circular moved * fix: format redirect_node.map() call on single line * fix(redis-rs): handle circular MOVED redirect in pipeline path Extract shared is_circular_moved_redirect() function to detect when a MOVED redirect points to the same address (circular redirect). Apply this detection to both single command and pipeline paths. For pipelines, circular MOVED errors now route through the reconnect logic instead of the normal redirect logic, matching the behavior of single commands. Added test to verify pipeline commands recover from circular MOVED + disconnect scenarios. * chore(deps-dev): bump maturin from 1.13.1 to 1.13.3 in /python in the patch-updates group across 1 directory (#5910) chore(deps-dev): bump maturin Bumps the patch-updates group with 1 update in the /python directory: [maturin](https://github.com/pyo3/maturin). Updates `maturin` from 1.13.1 to 1.13.3 - [Release notes](https://github.com/pyo3/maturin/releases) - [Changelog](https://github.com/PyO3/maturin/blob/main/Changelog.md) - [Commits](PyO3/maturin@v1.13.1...v1.13.3) --- updated-dependencies: - dependency-name: maturin dependency-version: 1.13.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: patch-updates ... * fix(redis-rs): improve circular MOVED detection with hostname/IP resolution - Add resolve_address parameter to is_circular_moved_redirect to handle cases where MOVED returns an IP but client connected via hostname - Fix resolve_address to preserve original port when resolving IP to hostname (the MOVED response port is authoritative) - Extend circular MOVED detection to pipeline path via handle_redirect_logic - Add unit tests for hostname vs IP detection scenarios - Add integration test for pipeline circular MOVED handling * style: fix cargo fmt formatting --------- (cherry picked from commit 87c9991) Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: James Xin <james.xin@improving.com> Co-authored-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
affonsov
pushed a commit
that referenced
this pull request
Aug 21, 2026
* Implement connection refresh on circular moved Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> * fix: format redirect_node.map() call on single line Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> * fix(redis-rs): handle circular MOVED redirect in pipeline path Extract shared is_circular_moved_redirect() function to detect when a MOVED redirect points to the same address (circular redirect). Apply this detection to both single command and pipeline paths. For pipelines, circular MOVED errors now route through the reconnect logic instead of the normal redirect logic, matching the behavior of single commands. Added test to verify pipeline commands recover from circular MOVED + disconnect scenarios. Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> * chore(deps-dev): bump maturin from 1.13.1 to 1.13.3 in /python in the patch-updates group across 1 directory (#5910) chore(deps-dev): bump maturin Bumps the patch-updates group with 1 update in the /python directory: [maturin](https://github.com/pyo3/maturin). Updates `maturin` from 1.13.1 to 1.13.3 - [Release notes](https://github.com/pyo3/maturin/releases) - [Changelog](https://github.com/PyO3/maturin/blob/main/Changelog.md) - [Commits](PyO3/maturin@v1.13.1...v1.13.3) --- updated-dependencies: - dependency-name: maturin dependency-version: 1.13.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: patch-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> * fix(redis-rs): improve circular MOVED detection with hostname/IP resolution - Add resolve_address parameter to is_circular_moved_redirect to handle cases where MOVED returns an IP but client connected via hostname - Fix resolve_address to preserve original port when resolving IP to hostname (the MOVED response port is authoritative) - Extend circular MOVED detection to pipeline path via handle_redirect_logic - Add unit tests for hostname vs IP detection scenarios - Add integration test for pipeline circular MOVED handling Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> * style: fix cargo fmt formatting Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> --------- Signed-off-by: Alex Rehnby-Martin <alex.rehnby-martin@improving.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modifies behaviour of glide when receiving a MOVED request to the same address. Now this triggers a reconnect.
Features / Behaviour Changes
When Redis/Valkey servers are deployed behind DNS records, load balancers, or proxies, a MOVED error may be returned with a target endpoint that is the same endpoint from which the error originated.
Before this change, when Glide received a MOVED error pointing to the same endpoint, the retry would fail because:
FatalReceiveError) propagates back to the applicationAfter this change, when a MOVED error points to the same endpoint (circular MOVED), the client:
This fix is similar to StackExchange.Redis PR #3003 which addresses the same issue.
Implementation
Core fix in
glide-core/redis-rs/redis/src/cluster_async/mod.rs:In the
RetryMethod::MovedRedirecthandler (~line 1343), added detection for circular MOVED:Key implementation details:
Next::Reconnectwithrequest: Some(request)which triggers reconnection AND queues the request for retry viapending_requests_txNew tests in
glide-core/redis-rs/redis/tests/test_cluster_async.rs:Added two tests that verify the fix by tracking connection establishment (via PING count):
test_async_cluster_circular_moved_triggers_reconnect- Tests GET command with circular MOVEDtest_async_cluster_circular_moved_set_triggers_reconnect- Tests SET command with circular MOVEDThe tests verify that:
Limitations
Testing
Unit tests:
GLIDE_VERSION=test cargo test --manifest-path glide-core/redis-rs/redis/Cargo.toml --test test_cluster_async -- test_async_cluster_circular_moved --nocaptureEnd-to-end test:
Checklist
Before submitting the PR make sure the following are checked:
make *-linttargets) and Prettier has been run (make prettier-fix).