Skip to content

use mapped address when sentinel failover moved pubsub connections#3190

Open
elimelt wants to merge 1 commit intoredis:masterfrom
elimelt:master
Open

use mapped address when sentinel failover moved pubsub connections#3190
elimelt wants to merge 1 commit intoredis:masterfrom
elimelt:master

Conversation

@elimelt
Copy link
Contributor

@elimelt elimelt commented Mar 4, 2026

Description

Closes #3192

Fix small bug in sentinel's new nodeAddressMap option - namely - when sentinel failovers cause pub-sub connections to migrate to a new master, the address mapping should be applied.

This is 100% fixed by the patch (I patched with pnpm and got my client working), but I found it kind of difficult to write a good test that doesn't completely duplicate an existing test (e.g. pubsub - channel - with master change)

I'm also debating whether we want getMasterNode and similar to return the mapped address or not


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Note

Medium Risk
Changes Sentinel failover reconfiguration logic for pub/sub connections; if the mapping is incorrect or incomplete it could cause pub/sub to reconnect to the wrong/unreachable node during master switches.

Overview
When Sentinel detects a new master, the pub/sub proxy now switches to the mapped node address (via getMappedNode(..., nodeAddressMap)) instead of using the raw Sentinel-reported host/port.

This fixes cases where nodeAddressMap is required (e.g., NAT/container networking) and failover previously moved pub/sub connections to an unmapped address.

Written by Cursor Bugbot for commit b7a34da. This will update automatically on new commits. Configure here.

@jit-ci
Copy link

jit-ci bot commented Mar 4, 2026

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.

@jit-ci
Copy link

jit-ci bot commented Mar 4, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@nkaradzhov
Copy link
Collaborator

@elimelt thanks for the PR, i will try to take a look soon, but im guessing - next week

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.

Pub-sub connections use unmapped addresses after Sentinel failover

2 participants