ServiceStack.Redis: Unable to connect: sPort: 0

Sometimes (not always) I get

"Unable to connect: sPort: 0"

when trying to get a value from Redis when using ServiceStack.Redis. Does anyone know what this could mean? I am using PooledRedisClientManager to get the client.

+6
source share
2 answers

I believe that you can fix this by increasing the ConnectTimeout pool. I set a very low level (10 ms), so when the pool was created, some clients could not connect in this short period. If the pool returned one of these clients, it would throw this error (port "0" - because it is not connected - it does not know which port it is not connected to). After a delay, all clients can connect.

I increased the connection timeout to 500 ms, and the problem disappeared - the clients all connected, although some of them were blocked for a couple of hundred milliseconds. But this is much better than a mistake.

+8
source

This may indicate that the port number or host address is incorrect.

-2
source

Source: https://habr.com/ru/post/922247/


All Articles