Skip to content

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

@dahston

Description

@dahston

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions