StackExchange / StackExchange/StackExchange.Redis

Misleading RedisConnectionException when attempting to connect in Sentinel mode with abortConnect=False

Open
#2,893 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

When attempting to create a new ConnectionMultiplexer instance while using a serviceName in the ConfigurationOptions (Sentinel mode) and with abortConnect=False, any failed connection returns a misleading exception that seems to imply that while a connection was established, the redis instance was detected as Standalone.

An exception of type 'StackExchange.Redis.RedisConnectionException' occurred in StackExchange.Redis.dll but was not handled in user code: 'Sentinel: The ConnectionMultiplexer is not a Sentinel connection. Detected as: Standalone'

This occurs even when the failure is the result of network issues, non-existent host, incorrect password etc

Package Version
2.8.37

Steps To Reproduce

  1. Attempt to create a ConnectionMultiplexer instance using an invalid host in the ConfigurationOptions, while specifying aservicename and abortConnect=False
    Image
    Image

  2. Observe exception indicates that a Standalone redis instance was detected
    Image

The same issue occurs for any type of connection failure (network issues, authentication failure).

I would expect a similar connection failure exception to be thrown as a standalone failure would (e.g. ConnectionFailureType.UnableToResolvePhysicalConnection)

The current message is misleading as no "detection" could have taken place. It implicitly suggests a connection was made, but that is not the case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with an invalid host, serviceName, and abortConnect=False, then trace the Sentinel connection failure handling that produces the RedisConnectionException. Compare this path with standalone connection failures, including network and authentication failures. Done means failed Sentinel connections report the actual failure without implying that a standalone Redis instance was detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.