Why signal R app throwing SocketClosed exception for RedisConnection(in aws) for and state is "ConnectedEstablished" and app works fine?

16 views Asked by At

I am connecting to redis aws elasticache , signal r application is broadcasting messages just fine with it, however getting below exception logged in error log -

StackExchange.Redis.RedisConnectionException: SocketClosed on cluster******/Subscription, Idle/MarkProcessed, last: PING, origin: ReadFromPipe, outstanding: 0, last-read: 0s ago, last-write: 11s ago, keep-alive: 60s, state: ConnectedEstablished, mgr: 7 of 10 available, in: 0, last-heartbeat: 0s ago, last-mbeat: 0s ago, global: 0s ago, v: 2.7.33.41805

Connection code looks as below -

ConfigurationOptions options = new()
            {
                EndPoints = { { "clustercfg.****.com:6379" } },
                Ssl = true,
                ChannelPrefix = "***",
                AbortOnConnectFail = true,
                ConnectRetry = 3,
                ConnectTimeout = 30
            };

            services.AddSignalR()
               .AddStackExchangeRedis(o =>
               {
                   o.ConnectionFactory = async writer =>
                   {
                      
                       var connection = await ConnectionMultiplexer.ConnectAsync(options, writer);
                       connection.ConnectionFailed += (_, e) =>
                       {
                           Console.WriteLine("connection.ConnectionFailed Connection to Redis failed.");
                       };

                       if (!connection.IsConnected)
                       {
                           Console.WriteLine("!connection.IsConnected Did not connect to Redis.");
                       }

                       return connection;
                   };
               });

How to resolve this exception? Am I missing something in the connection?

0

There are 0 answers