OpenA connection attempt failed because the connected party did not properly respond after a period of time #197
congruihuang opened this issue
2 months ago
Hi,
I use the library in our service and we got the bellowing exception and i haven't found any related possible reasons about raising such exception
Unhandled Exception: StackExchange.Redis.RedisConnectionException: SocketFailure on GET ---> System.IO.IOException: 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. ---> System.Net.Sockets.SocketException: 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
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult)
at StackExchange.Redis.PhysicalConnection.EndReading(IAsyncResult result) in c:TeamCityuildAgentwork3ae0647004edff78StackExchange.RedisStackExchangeRedisPhysicalConnection.cs:line 707
--- End of inner exception stack trace ---
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImplT in c:TeamCityuildAgentwork3ae0647004edff78StackExchange.RedisStackExchangeRedisConnectionMultiplexer.cs:line 1766
at StackExchange.Redis.RedisBase.ExecuteSyncTin c:TeamCityuildAgentwork3ae0647004edff78StackExchange.RedisStackExchangeRedisRedisBase.cs:line 81
at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in c:TeamCityuildAgentwork3ae0647004edff78StackExchange.RedisStackExchangeRedisRedisDatabase.cs:line 1431
mgravell2 months ago
That's: a socket timeout; IIRC the default socket timeout (we don't specify `ReceiveTimeout` in the code, so the default it all that applies) is 10 minutes (source: https://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.receivetimeout%28v=vs.110%29.aspx). Normally, I would expect the system to setup a keep-alive much lower than this, however: you could try specifying `KeepAlive` explicitly in the configuration; the time is in seconds. I would suggest 30 seconds as a first attempt. Normally, it negotiates the keep-alive internally by talking to the server, but this is not always available - especially if the `CONFIG` command is not available. Let me know if adding a keep-alive helps.
…
congruihuang2 months ago
Thanks for your replying, the explanation is pretty clear, yesterday i reviewed my logic and found there was possibly too much useless connection to the cache. I just changed the logic to see if it works
Comment on issue
Sign in to commentor sign up to join this conversation on GitHub
Desktop version