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

Error: Timeout performing GET {key}, inst: 1, queue: 2, qu=0, qs=2, qc=0, wr=0/0, in=0/0

Open Jackie-Yu opened this issue 12 years ago • 61 comments

We are using StackExchange.Redis in Azure Redis Cache, However it occasionally throws the exception - 'Timeout performing GET {key}, inst: 1, queue: 2, qu=0, qs=2, qc=0, wr=0/0, in=0/0'. Is there any setting or solution to resolve the issues?

Jackie-Yu avatar Aug 26 '14 07:08 Jackie-Yu

We have the same problem today any good news?

zhangpengchen avatar Aug 27 '14 12:08 zhangpengchen

Based on those numbers, 2 commands have been sent to the server ("qs"), but there is nothing yet available to read ("in"); is the server being blocked at any point here, perhaps via KEYS or other long-running operations? The "slowlog" command can be useful to understand if the server is stalling for any reason.

Marc

On 27 August 2014 13:22, zhangpeng-kooboo [email protected] wrote:

We have the same problem today any good news?

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-53564544 .

Regards,

Marc

mgravell avatar Aug 27 '14 13:08 mgravell

Hi Marc, We are using microsoft azure redis, not sure how can we run slowlog command :(

zhangpengchen avatar Aug 27 '14 13:08 zhangpengchen

{"Exception":"Timeout performing GET {KEY}, inst: 1, queue: 2, qu=0, qs=2, qc=0, wr=0/0, in=181/0\r\nStackTrace\r\n at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1773\r\n at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 79\r\n at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 1346\r\n at

This is our stack trace.

zhangpengchen avatar Aug 27 '14 14:08 zhangpengchen

k, that one is more revealing - the "in=181" tells me that there is data in the input - I will have to see if I can figure out why it hasn't been processed (note: it might not be a complete response, depending on what the data is)

On 27 August 2014 15:00, zhangpeng-kooboo [email protected] wrote:

{"Exception":"Timeout performing GET {KEY}, inst: 1, queue: 2, qu=0, qs=2, qc=0, wr=0/0, in=181/0\r\nStackTrace\r\n at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImplT in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1773\r\n at StackExchange.Redis.RedisBase.ExecuteSyncT in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 79\r\n at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 1346\r\n at

This is our stack trace.

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-53576098 .

Regards,

Marc

mgravell avatar Aug 27 '14 17:08 mgravell

In my case, the application servers are set in East Asia however azure redis server was created in WestUS which may raise this timeout performing exception. I moved azure redis server to East Asia then it get better, but still need to monitor whether it get resolved completely.

Jackie-Yu avatar Aug 28 '14 01:08 Jackie-Yu

It still gets exception occasionally : Timeout performing GET {Tkey}, inst: 3, queue: 25, qu=0, qs=25, qc=0, wr=0/0, in=0/0

Jackie-Yu avatar Aug 29 '14 02:08 Jackie-Yu

in=0/0 means: we're waiting from data from the server; specifically, the first 0 is the .Available on the socket; the second 0 is whether or not a worker is currently processing that data (which we would not expect if nothing is available). If you are seeing "in=0/0", then that suggests either a network stall or a server stall; unless something odd is happening like a socket break, it probably is not SE.Redis: SE.Redis has no response to process. You could try increasing the timeout.

mgravell avatar Aug 29 '14 09:08 mgravell

Talking from East Asia to WestUS will have noticeable latency, and will be subject to many possible network glitches; I strongly suggest you either minimize the latency (moving things to the same DC, ideally) or raise the timeout.

On 28 August 2014 02:01, Jackie Yu [email protected] wrote:

In my case, the application servers are set in East Asia however azure redis server was created in WestUS which may raise this timeout performing exception. I moved azure redis server to East Asia then it get better, but still need to monitor whether it get resolved completely.

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-53661504 .

Regards,

Marc

mgravell avatar Aug 29 '14 09:08 mgravell

I may have a breakthrough. I've been working with Matías following this stackoverflow question, and we've found at least one scenario where the TPL can hijack the reader thread. That is very very bad, and immediately will cause timeouts with data left in the queue. I am investigating, but hope to have a robust fix in the immediate future (i.e. today or tomorrow).

On 29 August 2014 10:21, Marc Gravell [email protected] wrote:

Talking from East Asia to WestUS will have noticeable latency, and will be subject to many possible network glitches; I strongly suggest you either minimize the latency (moving things to the same DC, ideally) or raise the timeout.

On 28 August 2014 02:01, Jackie Yu [email protected] wrote:

In my case, the application servers are set in East Asia however azure redis server was created in WestUS which may raise this timeout performing exception. I moved azure redis server to East Asia then it get better, but still need to monitor whether it get resolved completely.

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-53661504 .

Regards,

Marc

Regards,

Marc

mgravell avatar Sep 01 '14 11:09 mgravell

Great news, thks @mgravell :) Right now we are using try-catch to make sure we did not block the flow.

zhangpengchen avatar Sep 01 '14 12:09 zhangpengchen

Be good to get this fixed as we have this error a lot! :)

holidaycottages avatar Sep 01 '14 16:09 holidaycottages

You're welcome to try 1.0.329 on nuget - I know it addresses the scenario I was investigating earlier - it would be good to know if this is the same. Note that 1.0.329 is marked hidden, but it is there: https://www.nuget.org/packages/StackExchange.Redis/1.0.329

On 1 September 2014 17:19, holidaycottages [email protected] wrote:

Be good to get this fixed as we have this error a lot! :)

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-54076241 .

Regards,

Marc

mgravell avatar Sep 01 '14 16:09 mgravell

@mgravell 329 fixes the timeout exception I got in 328 with this test console app at least, https://gist.githubusercontent.com/Plasma/62f9e3a2010ed1a6e486/raw/748f32ce13680d9759f42b498abbfe8c3cbf2f8c/Program.cs so thats good

Plasma avatar Sep 01 '14 23:09 Plasma

Cool; sounds promising. We're dogfooding 329 in production at stackexchange

  • I'll release it as default tomorrow if nothing goes crazy On 2 Sep 2014 00:04, "Andrew Armstrong" [email protected] wrote:

@mgravell https://github.com/mgravell 329 fixes the timeout exception I got in 328 with this test console app at least, https://gist.githubusercontent.com/Plasma/62f9e3a2010ed1a6e486/raw/748f32ce13680d9759f42b498abbfe8c3cbf2f8c/Program.cs so thats good

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-54096131 .

mgravell avatar Sep 01 '14 23:09 mgravell

@mgravell I have tried 329 and still get the following error:

System.TimeoutException: Timeout performing EVAL, inst: 2, queue: 13, qu=0, qs=13, qc=0, wr=0/0, in=0/1 at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) at RedisAspNetProviders.SessionStateStoreProvider.GetItem(Boolean exclusive, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) at RedisAspNetProviders.SessionStateStoreProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

But I am thinking this could be we are using redis 2.8.13....

holidaycottages avatar Sep 02 '14 08:09 holidaycottages

I should change that output to be far more human readable ;p But that says:

  • there are 13 commands that have been been sent to redis that are awaiting responses
  • nothing is waiting to be written
  • no data is available on the socket to be consumed

so basically: redis hasn't responded yet, or the network has burped. You could try increasing your timeout; other things to check:

  • does SLOWLOG GET report any long-running operations that tie into this time-frame?
  • does the redis server report anything interesting in the main log at this time-frame? persistence, perhaps?
  • what is the latency and stability of your network?

EVAL in particular is a fun one, because I have no way of knowing what the expected performance of that is; a script could do 1xO(1) operation, or it could do 20000xO(N) operations.

Marc

On 2 September 2014 09:23, holidaycottages [email protected] wrote:

@mgravell https://github.com/mgravell I have tried 329 and still get the following error:

System.TimeoutException: Timeout performing EVAL, inst: 2, queue: 13, qu=0, qs=13, qc=0, wr=0/0, in=0/1 at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImplT at StackExchange.Redis.RedisBase.ExecuteSyncT at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) at RedisAspNetProviders.SessionStateStoreProvider.GetItem(Boolean exclusive, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) at RedisAspNetProviders.SessionStateStoreProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-54122066 .

Regards,

Marc

mgravell avatar Sep 02 '14 09:09 mgravell

Thanks for your reply Marc.

We are using rackspace and their internal network, I have pinged the server that is hosting redis and the latency is very low, I have asked rackspace before about network issues but I am assured there are none.

Our current timeouts are set to:

connectTimeout=5000 keepAlive=10 syncTimeout=1000

This particular error occurs when we are using a session state provider that uses stackexchange.redis.

The longest running task in SLOWLOG GET that I have seen is 202800 micro seconds, the rest come in at about 15600.

Should we increase the syncTimeout?

Thanks

Ben

holidaycottages avatar Sep 02 '14 09:09 holidaycottages

Check the redis server log at the time, you may find the common "fsync is slow and may slow down redis" style message during AOF rewrite when persistence is on. This actually freezes redis.

Sent from my iPhone

On 2 Sep 2014, at 7:28 pm, holidaycottages [email protected] wrote:

Thanks for your reply Marc.

We are using rackspace and their internal network, I have pinged the server that is hosting redis and the latency is very low, I have asked rackspace before about network issues but I am assured there are none.

Our current timeouts are set to:

connectTimeout=5000 keepAlive=10 syncTimeout=1000

This particular error occurs when we are using a session state provider that uses stackexchange.redis.

The longest running task in SLOWLOG GET that I have seen is 202800 micro seconds, the rest come in at about 15600.

Should we increase the syncTimeout?

Thanks

Ben

— Reply to this email directly or view it on GitHub.

Plasma avatar Sep 02 '14 09:09 Plasma

I have done a check on slowlog, and it does log the total time for slow EVALs, not just the individual operations - so that's good; if it isn't showing in slowlog, it probably isn't the EVAL's fault.

So as I already commented, and Andrew noted - the next important question becomes: did the server log report anything interesting at that time - in particular persistence, but anything else too.

Marc

On 2 September 2014 10:57, Andrew Armstrong [email protected] wrote:

Check the redis server log at the time, you may find the common "fsync is slow and may slow down redis" style message during AOF rewrite when persistence is on. This actually freezes redis.

Sent from my iPhone

On 2 Sep 2014, at 7:28 pm, holidaycottages [email protected] wrote:

Thanks for your reply Marc.

We are using rackspace and their internal network, I have pinged the server that is hosting redis and the latency is very low, I have asked rackspace before about network issues but I am assured there are none.

Our current timeouts are set to:

connectTimeout=5000 keepAlive=10 syncTimeout=1000

This particular error occurs when we are using a session state provider that uses stackexchange.redis.

The longest running task in SLOWLOG GET that I have seen is 202800 micro seconds, the rest come in at about 15600.

Should we increase the syncTimeout?

Thanks

Ben

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/83#issuecomment-54130861 .

Regards,

Marc

mgravell avatar Sep 02 '14 10:09 mgravell