Feature Request: Add Automatic ForceReconnect Recovery for Persistent ConnectionMultiplexer Connection Failures

Abierto
#3,309 9 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@meerasridharan-28 ya está trabajando en esto.

Desde el 3/11/2026.

  • #3333 de @meerasridharan-28 — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, redis

Línea de trabajo

Start by reading ConfigurationOptions and the ConnectionMultiplexer reconnection and retry behavior, then review the six issue comments for implementation guidance or unresolved concerns. The issue proposes configurable automatic ForceReconnect recovery after persistent connection failures, with thresholds and limits; done means the recovery behavior and configuration are defined and work as described without forcing reconnects for transient errors.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem
StackExchange.Redis normally handles connection recovery automatically through ConnectionMultiplexer. However, there are scenarios where an application may continue experiencing connection failures after a connectivity disruption, and normal reconnection and recovery mechanisms may not restore healthy connectivity.

Microsoft documents the ForceReconnect pattern as an additional recovery mechanism for these scenarios.
https://learn.microsoft.com/en-us/azure/redis/best-practices-connection#using-forcereconnect-with-stackexchangeredis

Today application using Stackexchange.Redis directly must implement this additional ForceReconnect recovery logic themselves.

Proposal
Consider adding a guarded automatic recovery mechanism to StackExchange.Redis for persistent connection-level failures.

The intent is not to force reconnection for every RedisTimeoutException or transient connection error. The existing ConnectionMultiplexer reconnection and retry mechanisms should remain the first line of recovery.

Only when connection failures persist beyond a configurable threshold should the library consider triggering stronger ForceReconnect recovery.

Suggested API Changes

Consider extending ConfigurationOptions with the following properties to configure automatic recovery from persistent connection failures.

bool AutoForceReconnect // default True
public TimeSpan AutoForceReconnectErrorThreshold { get; set; } // default 30s
public TimeSpan AutoForceReconnectMinInterval //default 60s
public TimeSpan AutoForceReconnectMaxDuration //default 5 mins

example Usage

`var options = ConfigurationOptions.Parse(
    "localhost:6379");

options.AutoForceReconnect = true;
options.AutoForceReconnectErrorThreshold = TimeSpan.FromSeconds(30);
options.AutoForceReconnectMinInterval = TimeSpan.FromSeconds(60);
options.AutoForceReconnectMaxDuration = TimeSpan.FromMinutes(5);

var redis = await ConnectionMultiplexer.ConnectAsync(options);`

Configuration

AutoForceReconnect: Enables or disables automatic forced recovery. Defaults to true

AutoForceReconnectErrorThreshold: The duration of persistent connection-level failures required before forced recovery is considered.

AutoForceReconnectMinInterval: The minimum interval between forced recovery attempts to prevent excessive connection recycling.

AutoForceReconnectMaxDuration: The maximum duration for which automatic recovery attempts may continue during a persistent connectivity issue.

Lenguaje dominante
C#
Estrellas
6.2k
Forks
1.6k
Merge medio
9 h 42 min
PR fusionados (30 d)
51

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de StackExchange/StackExchange.Redis

Todos los issues de StackExchange/StackExchange.Redis

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.