The timeout was reached before the message could be written to the output buffer

2k Views Asked by At

I'm trying to connect to the AWS Redis instance via the below c# code.

  
                        var option = new Microsoft.Extensions.Caching.StackExchangeRedis.RedisCacheOptions
                        {
                            ConfigurationOptions = ConfigurationOptions.Parse("master.test-redis-cluster.89run.use1.cache.amazonaws.com:6379,ssl=true,sslProtocols=Tls,abortConnect=false"),
                            InstanceName = "testapi",
                        };
                        IDistributedCache distributedCache = new RedisCache(option);


                        distributedCache.SetAsync("testKey", System.Text.Encoding.UTF8.GetBytes("testData"));

When I'm trying to set the value in the cache, I'm getting the below error. Though there is enough Threads, i'm getting this error.

{
    "Redis-Message": "HMGET testapi1fb31d10-ebee-4f39-9a73-9bc8901461e5",
    "Redis-Timeout": "5000",
    "Redis-OpsSinceLastHeartbeat": "0",
    "Redis-Queue-Awaiting-Write": "0",
    "Redis-Queue-Awaiting-Response": "0",
    "Redis-Active-Writer": "False",
    "Redis-Backlog-Writer": "CheckingForTimeout",
    "Redis-Server-Endpoint": "master.test-redis-cluster.89run.use1.cache.amazonaws.com:6379",
    "Redis-Multiplexer-Connects": "1/1/0",
    "Redis-Manager": "10 of 10 available",
    "Redis-Client-Name": "testapi-app-deployment-7674cf88nnl5(SE.Redis-v2.6.70.49541)",
    "Redis-ThreadPool-IO-Completion": "(Busy=0,Free=1000,Min=16,Max=1000)",
    "Redis-ThreadPool-Workers": "(Busy=0,Free=32767,Min=16,Max=32767)",
    "Redis-ThreadPool-Items": "(Threads=16,QueuedItems=0,CompletedItems=495)",
    "Redis-Busy-Workers": "0",
    "Redis-Version": "2.6.70.49541",
    "redis-command": "HMGET testapi1fb31d10-ebee-4f39-9a73-9bc8901461e5",
    "redis-server": "master.test-redis-cluster.89run.use1.cache.amazonaws.com:6379",
    "ex_msg": "The timeout was reached before the message could be written to the output buffer, and it was not sent, command=HMGET, timeout: 5000, inst: 0, qu: 0, qs: 0, aw: False, bw: CheckingForTimeout, serverEndpoint: master.test-redis-cluster.89run.use1.cache.amazonaws.com:6379, mc: 1/1/0, mgr: 10 of 10 available, clientName: testapi-app-deployment-7674cf88nnl5(SE.Redis-v2.6.70.49541), IOCP: (Busy=0,Free=1000,Min=16,Max=1000), WORKER: (Busy=0,Free=32767,Min=16,Max=32767), POOL: (Threads=16,QueuedItems=0,CompletedItems=495), v: 2.6.70.49541 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)"
}

Not able to figure out why.

Since there is no connection error, it seems the code was able to connect to Redis. Also in error payload size is not there so again huge payload size possibility is ruled out.

Please note:

There are many similar questions in stack overflow and tried all of them. But, no luck.

We recently updated our API from .net 3.1 to 6. After this, we started to face this issue, and currently, API is not working at all. There is a sufficient number of threads and works I can see. Also we tried by increasing the timeout but again no luck.

0

There are 0 best solutions below