Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServiceStack.Redis: Unable to Connect: sPort: 0

Sometimes (not always) I am getting

"Unable to Connect: sPort: 0"

error when trying to get value from Redis when using ServiceStack.Redis. Does anyone know what that might mean? I am using PooledRedisClientManager to get the client.

like image 693
Klotin Avatar asked Aug 06 '12 21:08

Klotin


1 Answers

I believe you can fix this by increasing the pool's ConnectTimeout. I had it set very low (10ms), so when the pool was created, some of the clients were unable to connect in that short period. If the pool returned one of these clients, it would throw this error (the "0" port is because it's not connected -- it doesn't know what port it's not connected to). After a delay, all of the clients are able to connect.

I increased my connect timeout to 500ms, and the problem went away -- the clients all connect, though some of them block for a couple hundred milliseconds. But that's much better than an error.

like image 140
kevingessner Avatar answered Nov 15 '22 12:11

kevingessner