Web Api Requests Queueing up forever on IIS (in state: ExecuteRequestHandler)
Asked Answered
C

2

9

I'm currently experiencing some hangs on production environment, and after some investigation I'm seeing a lot of request queued up in the worker process of the Application Pool. The common thing is that every request that is queued for a long time is a web api request, I'm using both MVC and Web API in the app.

The requests are being queued for about 3 hours, when the application pool is recycled they immediately start queueing up.

They are all in ExecuteRequestHandler state

Any ideas for where should I continue digging?

Citified answered 30/6, 2016 at 19:17 Comment(2)
Did you ever solve this issue? I have the exact same oneClotilde
Had the same issue, apparently application code was waiting in a non existent conn string with connection timeout 0Heraclea
B
5

Your requests can be stalled for a number of reasons:

  • they are waiting on I/O operation e.g database, web service call
  • they are looping or performing operations on a large data set
  • cpu intensive operations
  • some combination of the above

In order to find out what your requests are doing, start by getting the urls of the requests taking a long time.

You can do this in the cmd line as follows

c:\windows\system32\inetsrv\appcmd list requests

If its not obvious from the urls and looking at the code, you need to do a process dump of the w3wp.exe on the server. Once you have a process dump you will need to load it into windbg in order to analyze what's taking up all the cpu cycles. Covering off windbg is pretty big, but here's briefly what you need to do:

  • load the SOS dll (managed debug extension)
  • call the !runaway command
  • to get list of long running threads dive into a long running thread by selecting it and calling !clrstack command

There are many blogs on using windbg. Here is one example. A great resource on analyzing these types of issues is Tess Ferrandez's blog.

Brede answered 11/7, 2016 at 11:8 Comment(0)
C
0

This is a really long shot without having first hand access to your system but try and check the Handler mappings in IIS Manager gui for your WebApi. Compare it with IIS settings of your DEV or any other Env where it works.

IF this isnt the issue then do a comparison of all other IIS settings for that App.

Good luck.

Curkell answered 8/7, 2016 at 1:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.