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

Aperta
#3,309 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@meerasridharan-28 ci sta già lavorando.

Dal 3/11/2026.

  • #3333 di @meerasridharan-28 — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, redis
Ambito
backend, databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
6.2k
Fork
1.6k
Merge medio
9h 42m
PR unite (30g)
51

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di StackExchange/StackExchange.Redis

Tutte le issue di StackExchange/StackExchange.Redis

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.