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

Uncontrolled growth of connected clients on production Redis. #429

Open
talha-munir-2020 opened this issue Sep 15, 2021 · 0 comments
Open

Comments

@talha-munir-2020
Copy link

Describe the bug
We have a server that processes background jobs. Redis is uses as cache manager to overcome the load from SQL database. The object for IRedisCacheClient is singleton but I observed too many active connections. I had to reboot the server because too much ports were in use and user crashed. Connections are from known clients, but too many ports were exposed due to that the server gets down and had to reboot.

Code for registering the dependencies

builder.RegisterType<RedisCacheConnectionPoolManager>().As<IRedisCacheConnectionPoolManager>().SingleInstance();
           builder.RegisterType<RedisCacheClient>().As<IRedisCacheClient>().SingleInstance();

           builder.RegisterType<NewtonsoftSerializer>().As<ISerializer>();

           builder.Register((context) =>
           {
               var redisCacheClient = EngineContext.Current.Resolve<IRedisCacheClient>();
               return redisCacheClient.GetDbFromConfiguration();
           }).SingleInstance();

           builder.Register((context) =>
           {
               return new RedisConfiguration()
               {
                   Hosts = new RedisHost[] { new RedisHost() { Host = _config.CoreSecrets.RedisHost, Port = port } },
                   Ssl = false,
                   ConnectTimeout = 15 * 1000,
                   SyncTimeout = 5000,
                   AbortOnConnectFail = false,
                   PoolSize = 10
               };
           }).SingleInstance();

image

  • OS: Windows
  • Runtime version .NET Framework 4.6.2
  • Library Version 6.4.5
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

1 participant