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

Redis timeouts and memory dump shows... deadlock?

Open razzemans opened this issue 4 years ago • 3 comments

We were running a load test on our Azure App Service and I see some confusing results. Actually the applications crashed, mostly an OutOfMemoryException, but the dump files and logs show some data that I would like to fully comprehend. First of all, most of the logs show something like:

Timeout awaiting response

(outbound=5490KiB, inbound=13804KiB, 8890ms elapsed, timeout is 5000ms), 
command=GET, 
active: GET XXX, 
next: GET XXX, 
inst: 0, 
qu: 175, 
qs: 0, 
aw: True, 
bw: WritingMessage, 
rs: ComputeResult, 
ws: Writing, 
in: 65536, 
serverEndpoint: xxx,
mc: 1/1/0, 
mgr: 8 of 10 available, 
clientName: XXX(SE.Redis-v2.5.43.42402), 
IOCP: (Busy=5,Free=995,Min=200,Max=1000), 
WORKER: (Busy=13,Free=1010,Min=200,Max=1023), 
POOL: (Threads=138,QueuedItems=25,CompletedItems=9768), 
v: 2.5.43.42402

The dump files shows there are 172 tasks waiting on another thread:

image

Which is actually this code:

image

Then if I drill down on the "lock owned by thread 33216" it points me to this line of code:

image

Questions:

  1. Is this an actual deadlock?
  2. Do these 172 threads more or less correlate with the qu number in the log message (which is the number of items queued to be written if I am correct)
  3. What is the difference between inbound and in?
  4. Any other troubling observations from the log?

I have a feeling we were just CPU bound on our App Service (even though we weren't hitting 100% CPU) and what I am seeing is the consequence of that, but I just want to be sure.

razzemans avatar Nov 17 '22 13:11 razzemans

I'm not sure what your threads are doing (looks like some wrappers are in play there), but you probably do want a few tweaks against deadlocks for older platforms in #2229, which are in the 2.6.66+ releases - so definitely recommend upgrading to latest here if that's what you're hitting!

NickCraver avatar Nov 17 '22 14:11 NickCraver

Ok will definitely update to the latest packages. Thanks for the swift reply.

razzemans avatar Nov 17 '22 14:11 razzemans

Given this is almost certainly the resolved issue, going to close this out - @razzemans if the problem remains, please ping here and we'll reopen!

NickCraver avatar Nov 23 '22 14:11 NickCraver