Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket error #24

Open
ofirgeller opened this issue Sep 4, 2014 · 2 comments
Open

socket error #24

ofirgeller opened this issue Sep 4, 2014 · 2 comments

Comments

@ofirgeller
Copy link

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](RedisCommand1 command)
at Common.Cache.csRedis.AddStringToCache(String key, String value, Nullable`1 minutes)

@ctstone
Copy link
Owner

ctstone commented Sep 5, 2014

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.

@ofirgeller
Copy link
Author

I will try that, any thing to be careful of?

@ofirgeller ofirgeller reopened this Sep 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants