StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

RedisConnectionException at each first Connect(), while redis-py and hiredis work fine

Open tw-bert opened this issue 12 years ago • 103 comments

Hi Marc,

Version 1.0.289.0 (nuget, .net 4.0).

When I leave my workstation alone for five minutes, after calling Connect() I get a RedisConnectionException the first time. Immediately retrying does work with no delay at a 90% success rate. No info is written to the supplied TextWriter.

var oCli = ConnectionMultiplexer.Connect("srv-flux-01:14144", log);

Complete exception message:

An unhandled exception of type 'StackExchange.Redis.RedisConnectionException' occurred in StackExchange.Redis.dll
Additional information: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail

I connect from Win7 Pro X64 to Redis 2.8.9 (x64) on a Debian machine on our LAN (same subnet). No hardware firewalls in between, only Windows firewall. Redis connections from redis-py or RedisDesktopManager(which uses hiredis) never fail, and always connect within milliseconds.

I use a simple Windows Forms project, VS2013 Express, for testing. I use (and need) the .NET Framework 4 Client Profile.

Any ideas?

Kind regards, TW

tw-bert avatar May 09 '14 23:05 tw-bert

after disable AbortOnConnectFail, ConnectionMultiplexer.Connect() will success but still takes too long time(nearly 1 minute). I have tried many ways and after calling "ThreadPool.SetMinThreads(100, 200)", bingo, connect succeed very fast. Still I don't know why, may be thread starvation? Can anyone explain?

tianzhiyuan avatar Sep 08 '16 05:09 tianzhiyuan

First guess is that there are blocked worker/completion port threads and the defaults are causing contention. Setting the minimum threads shouldn't be necessary.

rjmooney avatar Sep 08 '16 19:09 rjmooney

upgrade to 1.1.608 from 1.1.606, got this error.

afpro avatar Oct 08 '16 06:10 afpro