Skip to content

use mapped address when sentinel failover moved pubsub connections - #3190

Merged
nkaradzhov merged 4 commits into
redis:masterfrom
elimelt:master
May 11, 2026
Merged

nkaradzhov merged 4 commits into
redis:masterfrom
elimelt:master

Conversation

@elimelt

@elimelt elimelt commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

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
Touches Sentinel topology reconfiguration and exports RedisSentinelInternal, which could affect pub/sub reconnection behavior and public API surface despite being a small, targeted fix with a regression test.

Overview
Fixes a Sentinel failover edge case where the pub/sub proxy was reconnected using the raw sentinel-reported master address instead of the nodeAddressMap-mapped address.

Exports RedisSentinelInternal and adds a focused unit test (pub-sub-master-change.spec.ts) asserting PubSubProxy.changeNode receives the mapped host/port; also includes small typing/lint cleanups (explicit any suppression, unused param, safer error casting, Promise<unknown>).

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

@jit-ci

jit-ci Bot commented Mar 4, 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.

@jit-ci

jit-ci Bot commented Mar 4, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@nkaradzhov

Copy link
Copy Markdown
Collaborator

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

@eczajk1

eczajk1 commented May 7, 2026

Copy link
Copy Markdown

confirmed that this is an issue

@elimelt

elimelt commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@nkaradzhov any chance you could take a look?

nkaradzhov and others added 3 commits May 11, 2026 13:54
Stubs PubSubProxy.changeNode and drives transform() with a synthetic
analyzed object to assert the mapped address is used on failover.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surfaced by lint:changed against the PR base. Touches only lint-clean
patches: const over let, unknown over any in transform()'s promise list,
narrowed catch binding, removed write-only #configEpoch, eslint-disable
on the dynamic Multi-prototype access, _-prefix on unused param.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nkaradzhov

Copy link
Copy Markdown
Collaborator

Hi all, apologies for the delay!

@nkaradzhov
nkaradzhov merged commit 23e16ac into redis:master May 11, 2026
18 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.

Pub-sub connections use unmapped addresses after Sentinel failover

3 participants