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

Aberta
#3,309 9 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@meerasridharan-28 já está trabalhando nisso.

Desde 3/11/2026.

  • #3333 de @meerasridharan-28 — aberto

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
38/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
csharp, redis
Domínio
backend, databases

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C#
Estrelas
6.2k
Forks
1.6k
Merge médio
9h 42min
PRs com merge (30d)
51

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de StackExchange/StackExchange.Redis

Todas as issues de StackExchange/StackExchange.Redis

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.