Skip to content

Connection instability issues bubbling up #2985

@AaronMousaviSitecore

Description

@AaronMousaviSitecore

Hi all,

Ever since our self-hosted Redis instances moved to Azure Managed Redis (AMR) we have been seeing a lot of exceptions coming from StackExchange.Redis which weren't there before. AMR has a lot more moving parts compared to the previous set-up and that seems to cause more connections getting dropped and replaced. The issues are intermittent and StackExchange.Redis does a good job of restoring the connections, but in the meantime it is bubbling up exceptions that are causing issues.

Could you please handle these exceptions internally? This avoids a lot of extra work on our side, like adding a retry on many places and it keeps the code cleaner. StackExchange.Redis is just fine with handling these issues, but while it is handling the issue, can it e.g. wait or retry the operations internally?

Some details of our set-up:

  • StackExchange.Redis 2.8.31
  • .NET 8.0
  • Ubuntu 22.04.5 LTS
  • Kernel 5.15.0-1092-azure x64

Some (redacted) exceptions:

StackExchange.Redis.RedisConnectionException: SocketClosed on instance_name.australiaeast.redis.azure.net:10000/Subscription, Idle/MarkProcessed, last: UNSUBSCRIBE, origin: ReadFromPipe, outstanding: 1, last-read: 0s ago, last-write: 0s ago, unanswered-write: 0s ago, keep-alive: 60s, state: ConnectedEstablished, mgr: 9 of 10 available, in: 0, last-heartbeat: 0s ago, last-mbeat: 0s ago, global: 0s ago, v: 2.8.31.52602
   at StackExchange.Redis.ChannelMessageQueue.UnsubscribeAsyncImpl(Exception error, CommandFlags flags) in /_/src/StackExchange.Redis/ChannelMessageQueue.cs:line 351
System.InvalidOperationException: Reading is not allowed after reader was completed.
   at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed()
   at StackExchange.Redis.PhysicalConnection.ReadFromPipe()

The problem is similar to the ticket here #2692. It is very unlikely this relates to dispose issues as we have not seen that in years and the related code has not changed. The only change was moving to AMR (which including moving from Redis 6 to 7).

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