Repository navigation
Pub/sub: a multi-node subscription forgets its disconnected nodes, not its connected ones - #3374
Merged
Merged
Conversation
…t its connected ones MultiNodeSubscription.RemoveDisconnectedEndpoints had its test inverted: when any subscription connection dropped, a keyspace-notification subscription dropped every *connected* node from its tracking and kept the dead one. The healthy nodes then reported as not subscribed (ISubscriber.IsConnected returned false) and, because unsubscribe only walks the tracked nodes, an unsubscribe before the next restore never reached them, leaving them subscribed on the server. The single-node flavour has always had the condition the right way round.
This was referenced Nov 23, 2026
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.
MultiNodeSubscription.RemoveDisconnectedEndpointshad its condition inverted: it flagged the connected nodes for removal and kept the disconnected ones. The single-node flavour has always had it the right way round.ServerEndPoint.OnDisconnectedcalls this (viaUpdateSubscriptions) whenever any subscription connection drops, so for a keyspace-notification subscription on a cluster, one node dropping meant:ISubscriber.IsConnected(channel)reportedfalsealthough the healthy nodes were still subscribed and delivering;The next restore re-adds the healthy nodes (a redundant
PSUBSCRIBEeach), which is why this has mostly gone unnoticed.Change
One character:
if (server.Value.IsSubscriberConnected)becomesif (!server.Value.IsSubscriberConnected).This hunk is also in #3353; splitting it out here so it can be reviewed and tested on its own. #3353 should drop it once this lands.
Test
MultiNodeSubscriptionTrackingTests(in-process server, no external Redis): subscribes to a keyspace channel, adds a tracked-but-disconnected node, runsUpdateSubscriptions, and asserts the connected node is still tracked and the dead one is gone. It fails onmain(the connected node is no longer tracked) and passes with the fix.