StackExchange / StackExchange/StackExchange.Redis
Misleading RedisConnectionException when attempting to connect in Sentinel mode with abortConnect=False
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
-
Attempt to create a ConnectionMultiplexer instance using an invalid host in the ConfigurationOptions, while specifying aservicename and abortConnect=False
-
Observe exception indicates that a Standalone redis instance was detected
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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