socket error
ofirgeller opened this issue · 2 comments
any idea what is the reason for this?
i am creating a new csRedis client for every request. is this a bad practice? i know clients like SE.redis reuse the connection. but the examples on this repo show the using statement so that is what i did.
System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted 191.234.53.96:6379
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
at System.Net.Sockets.Socket.Connect(String host, Int32 port)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at CSRedis.Internal.RedisConnector.Connect()
at CSRedis.Internal.RedisConnector.Call[T](RedisCommand1 command) at CSRedis.RedisClient.Write[T](RedisCommand
1 command)
at Common.Cache.csRedis.AddStringToCache(String key, String value, Nullable`1 minutes)
CSRedis does not (yet) use connection pooling, so it sounds like you are exhausting your ephemeral port range with many closed connections hanging around in the TIME_WAIT state, which according to this old blog post is 240 seconds.
For now, you can try reusing a shared (static) csredis instance with the Async methods and Reconnect enabled. Meanwhile I'll investigate connection pooling.
I will try that, any thing to be careful of?