dotnet / dotnet/aspnetcore

DistributedCache : ForceReconnect does not work correctly with ConnectionMultiplexerFactory

Open
#55,898 2 comments 0 reactions 0 assignees View on GitHub
area-networking feature-caching
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Our application runs on Azure App Service (Linux) in a docker container.

Following numerous lost connections to the Redis cache, we activated ForceReconnect with the switch “Microsoft.AspNetCore.Caching.StackExchangeRedis.UseForceReconnect”.

This worked fine until we used ConnectionMultiplexerFactory in the StackExchangeRedisCache configuration: the factory connection was released but never reconnected : https://github.com/dotnet/aspnetcore/blob/13a7e9d7223e2041fa4efa0aebf1a7c375a5670f/src/Caching/StackExchangeRedis/src/RedisCache.cs#L289-L297 On subsequent requests, ObjectDisposedExceptions are thrown.

Is this the expected behavior? Is it better to modify the Factory to take account of this case (taking into account other services using it) or to disable the ForceReconnect pattern, which is probably useless since https://github.com/StackExchange/StackExchange.Redis/pull/2610 ?

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

6.0

### Anything else?

Microsft.Extensions.Caching.StackExchangeRedis : 8.0.3
StackExchange.Redis : 2.7.33

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.