Occassional socketexception when using Azure Redis

Hi, I am getting sporadic errors when using Azure Redis & ServiceStack.Redis. I have read that during large “fork” operations Redis can be offline for some time.

Is there anything I can do to handle this intelligently?

G

System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote    host;   at ServiceStack.Redis.RedisNativeClient.FlushSendBuffer()"

This is due to the remote server dropping the TCP Socket connection.

What version of ServiceStack.Redis are you using?

4.0.42, although will be upgrading the customers to 4.0.46 in the next week.

Upgrading to the latest version will help as automatic retries support was added in v4.0.44

Fantastic, thanks. g

hi demis,
i’m not sure if its ok to revive this topic or create a new one.

We actually have the same issue with azure redis-> we run into the exact same Exception as grahamlaidler describes.

So i’m thinking of adjusting the values for

RedisConfig.DefaultRetryTimeout = 3000;
RedisConfig.BackOffMultiplier = 10;```

to fight the sympton with a retry. Do you have some experiences/recommendations for those values for azure redis? 

thank you for any tips/hints.

tobi

Auto retries should be automatic using the default settings above, I don’t have any specific recommendations for Azure Redis.

But we just fixed an issue on re-connections with AUTH as described in this previous thread: Redis: NOAUTH Authentication required

So maybe look at v4.0.55 on MyGet to see if it handles reconnections more gracefully.

thx again for the fast response.

this looks very promising! do you already know when v4.0.56 is officallyout? pre releases affect our build chain so maybe we don’t have to adapt there if v4.0.56 is just about to be released.

Expecting v4.0.56 to be released either next week or week after.

Hi,

In case others are experiencing a similar problem with occassional connection drop to Azure Redis, we have found a workaround that works in our case which was to disable SSL in the connection string.

Error was: »An existing connection was forcibly closed by the remote host«
Workaround:
***@subdomain.redis.cache.windows.net?ssl=true => ***@subdomain.redis.cache.windows.net:6379?ssl=false

This workaround followed the solution mythz provided in version 4.0.55, where the connection drop due to NOAUTH was handled with auto-reconnect. So we had a way to reconnect but still had to figure out why it happens. The original thread is here

Hope this helps!

2 Likes