0
votes

My app is hosted in azure and i am using azure redis cache.

RedisClient version Redis.StrongName - 1.2.6 .Net Core - 2.1 .Net Framework 4.7.1

My app is getting intermittent Redis Connection exception, and it gets resolved once i restart the app service. I have 1 - secondary and 1 - primary instance, which Redis cache of 6GB capacity

This is exception i got from my client

outer message: No connection is available to service this operation: HSETNX KEYNAME; SocketClosed on MY REDIS SERVER NAME/Interactive, origin: ProcessReadBytes, input-buffer: 0, outstanding: 0, last-read: 0s ago, last-write: 0s ago, unanswered-write: 280531s ago, keep-alive: 60s, pending: 0, state: ConnectedEstablished, in: 0, ar: 0, last-heartbeat: 0s ago, last-mbeat: 0s ago, global: 0s ago, mgr: Inactive, err: never; IOCP: (Busy=1,Free=999,Min=8,Max=1000), WORKER: (Busy=1,Free=32766,Min=8,Max=32767), Local-CPU: n/a

Inner Message: SocketClosed on MY REDIS SERVER NAME/Interactive, origin: ProcessReadBytes, input-buffer: 0, outstanding: 0, last-read: 0s ago, last-write: 0s ago, unanswered-write: 280531s ago, keep-alive: 60s, pending: 0, state: ConnectedEstablished, in: 0, ar: 0, last-heartbeat: 0s ago, last-mbeat: 0s ago, global: 0s ago, mgr: Inactive, err: never

Not sure what went wrong, it is resolved once I restarted the app service.

Please guide me on What went wrong? How to debug Redis exceptions? How to interpret the exception messages?

I referred some already posted issues in stackexchange.Redis, but nothing providing good info on the root cause of this issue https://github.com/StackExchange/StackExchange.Redis/issues/559

My CPU percentage and Redis Server Load, looks fine no anomolies

need to find out the root cause what went wrong and

1

1 Answers

0
votes

The exception says pretty clearly what happened - someone closed your socket. This could be from the server side because it was timed out (Azure redis only keeps it alive for ten minutes if the connection is inactive], or because the server had to temporarily close connections during a failover, or because of an issue in the intervening network.

But there is also some chance it could be due to a bug in your app causing the socket to be closed by e.g. disposing of the connection prematurely.