StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.88k stars 1.51k forks source link

SocketFailure on xx.redis.cache.windows.net:6380/Interactive, Idle/Faulted, last: GET, origin: ReadFromPipe, outstanding: 12, last-read: 22s ago #2703

Open jejass opened 5 months ago

jejass commented 5 months ago

Client library: "StackExchange.Redis" Version="2.7.33" Redis: Azure cache for Redis Symptom: SocketFailure on xx.redis.cache.windows.net:6380/Interactive, Idle/Faulted, last: GET, origin: ReadFromPipe, outstanding: 12, last-read: 22s ago, last-write: 1s ago, unanswered-write: 19s ago, keep-alive: 60s, state: ConnectedEstablished, mgr: 9 of 10 available, in: 0, last-heartbeat: 1s ago, last-mbeat: 0s ago, global: 0s ago, v: 2.7.33.41805 Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

This issue happens rarely and intermittently. from the https://github.com/StackExchange/StackExchange.Redis/issues/1100, it should be fixed 2.1.x. but the latest version is used and the issue still happen.

Any help would be greatly appreciated.

philon-msft commented 4 months ago

How rare and intermittent are we talking here? Azure Redis caches close client connections several times per month for routine maintenance including updates to cache components and Azure infrastructure. For more info see: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-failover

StackExchange.Redis will automatically recover connections after they're reset by the server, usually within a couple seconds. To help your application handle resets gracefully, we recommended building some resilience into it, for example with a command retry strategy like https://github.com/App-vNext/Polly. More suggestions for building resilience here: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-best-practices-connection