Base solution for your next web application
Open Closed

StackExchange.Redis.RedisTimeoutException: Timeout #6559


User avatar
0
Leonardo.Willrich created

Hi,

When I am deploing my application I am getting this error: StackExchange.Redis.RedisTimeoutException: Timeout. In my development environment it doesn't happen.

It only happens for Caches used by AbpZero framework (i.e. AbpZeroTenantCache, AbpTenantSettingsCache). Using caches created by my routines I am not getting any issue.

I have already read the article http://stackexchange.github.io/StackExchange.Redis/Timeouts, but so far I have any idea how to fix it.

Any idea how to fix those exceptions? My log files is getting full.

Best regards!

Full exception:

2019-02-28 01:30:53,937 [37 ] Abp.Runtime.Caching.Redis.AbpRedisCache - StackExchange.Redis.RedisTimeoutException: Timeout performing GET n:AbpZeroTenantCache,c:2, inst: 3, queue: 12, qu: 0, qs: 12, qc: 0, wr: 0, wq: 0, in: 4257, ar: 0, clientName: FRESHRF, serverEndpoint: Unspecified/localhost:6379, keyHashSlot: 10529 (Please take a look at this article for some common client-side issues that can cause timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts)
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 2120
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81
at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 1647
at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key)
at Abp.Runtime.Caching.CacheBase.Get(String key, Func`2 factory)
StackExchange.Redis.RedisTimeoutException: Timeout performing GET n:AbpZeroTenantCache,c:2, inst: 3, queue: 12, qu: 0, qs: 12, qc: 0, wr: 0, wq: 0, in: 4257, ar: 0, clientName: FRESHRF, serverEndpoint: Unspecified/localhost:6379, keyHashSlot: 10529 (Please take a look at this article for some common client-side issues that can cause timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts)
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 2120
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81
at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 1647
at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key)
at Abp.Runtime.Caching.CacheBase.Get(String key, Func`2 factory)

18 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Are you deploying on Azure? related: https://github.com/aspnetzero/aspnet-zero-core/issues/1794

  • User Avatar
    0
    Leonardo.Willrich created

    No, I am deployinng on Windows Server 2012 R2 IIS version 8.5.9600.16384.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @Leonardo.Willrich

    It is a hard one to figure out.

    • Does your data for the dev environment and server are same ?
    • You can also check Window's Event Viewer to see if is there any helpful error message.
  • User Avatar
    0
    Leonardo.Willrich created

    Hi @ismcagdas

    They are different databases, however, almost the same data. The database and tables are really small compared with caches that I use in my routines. I am getting erros only in apb routine.

    I will try Windows's Event Viewer.

  • User Avatar
    0
    Leonardo.Willrich created

    Guys,

    I am still struggling to fix it. My logs have tons and tons of ERROR with Timeout, and only for "AbpUserSettingsCache".

    Some idea?

  • User Avatar
    0
    Leonardo.Willrich created

    In additional,

    I realized that in my appsettings.json I have these configuration:

    "Abp": { "RedisCache": { "ConnectionString": "localhost", "DatabaseId": -1 } },

    And in my preInitialize() method I have these lines:

            //Uncomment this line to use Redis cache instead of in-memory cache.
            //See app.config for Redis configuration and connection string
            Configuration.Caching.UseRedis(options =>
            {
                options.ConnectionString = _appConfiguration["Abp:RedisCache:ConnectionString"];
                options.DatabaseId = _appConfiguration.GetValue<int>("Abp:RedisCache:DatabaseId");
            });
            
    

    Maybe is there something wrong with that?

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi,

    DatabaseId: -1 is refered to Redis Default database. It shouldn't be a problem.

  • User Avatar
    0
    Leonardo.Willrich created

    Hi ryancyq

    The most strange is in my local machine, development environment, it works fine. Only when it is running in our non-production environment with the application published in a ISS server it happens.

    Some idea what is going on? Any configuration maybe I am missing?

  • User Avatar
    0
    ryancyq created
    Support Team

    Do you have these config in your appSettings.Production.json?

    "Abp": {
        "RedisCache": {
            "ConnectionString": "localhost",
            "DatabaseId": -1
        }
    },
    
  • User Avatar
    0
    Leonardo.Willrich created

    I don't have. I have only appsettings.json. I always delete the others appsettings files. Should I have it? Others parameters are being reading from appsettings.json normally.

  • User Avatar
    0
    maliming created
    Support Team

    @Leonardo.Willrich Does it always make this error when you publish it to a production environment?

  • User Avatar
    0
    Leonardo.Willrich created

    @maliming

    Yes, always. It is leaving my log file full. It isn't a production environment, it is a non-production, but it is quite similar to a production environment. My application isn't realease to production so far. I am really worried if it can be a issue or not, that is the reason I am trying to tidy it up.

    At this moment, there are only 2 users using the application, in 3 hours the log has more than 1 mb only with this Redis Cache error.

  • User Avatar
    0
    maliming created
    Support Team

    Are you convenient to share your project source code, let us reproduce this problem?

  • User Avatar
    0
    Leonardo.Willrich created

    @maliming Do you have a contact? email or skype? The project is quite complex, it is logged in two different databases and for security reason I am not able to allow outside connections. But, maybe you can connect in my enrironment remotly using Team Viewer or something like that.

  • User Avatar
    0
    maliming created
    Support Team

    Can you reproduce using the zero demo project? The main problem is that redis has nothing to do with other components.

  • User Avatar
    0
    Leonardo.Willrich created

    I am not sure. I have to spend some time doing that. I'll do it and let you know as soon as possible!

  • User Avatar
    0
    Leonardo.Willrich created

    Resolved. I added to redis connection string the parameter syncTimeout=10000.

  • User Avatar
    0
    fupanda created

    Thank you for posting the solution Leonardo.Willrich. This saved me a lot of headache!