question

Chad-2467 avatar image
0 Votes"
Chad-2467 asked SamWu-MSFT edited

Connection is reset when setting Virtual Memory Limit in IIS App pool

It appears that setting the Virtual Memory limit on an IIS app pool will cause long running connections to reset after a random amount of time. I have an ASP.NET web api hosted in IIS (Windows Server 2019 Standard). Some async endpoints in the API take up to 5 min to return and they return a good amount of data (10MB). When I set the Virtual Memory Limit of the app pool to 4000000 (ie. 4GB), the connection will randomly get reset for long running requests. After watching the IIS worker process in task manager, I noticed consistent behavior across all 5 of our web servers.

Here's an example of the behavior causing the issue:

  1. When the async request comes in, the PID of the app pool is 21000

  2. After a random amount of time, lets say 20 seconds, a new IIS Worker Process is created for the same rest api with PID 2300 (I thought this was strange)

  3. The worker process with PID 2300 is killed after a random amount of time - say 1 min.

  4. After about another min, the original iis worker process with PID 21000 is killed and immediately causes the "Connection reset" error on the client.

  5. At the same time a new IIS worker process is created with PID 25000.

I can easily reproduce the above behavior on all 5 of our web servers (that are load balanced btw) by setting the Virtual Memory Limit on the api's app pool. When it's set to 0, the problem goes away.



windows-apiwindows-server-iis
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If I'm doing something wrong, please let me know. Otherwise I posted this question as a way to raise a potential issue with Microsoft IIS. My intent for setting the Virtual memory limit was to prevent external clients from abusing our rest services- causing server performance issues. However, I may try setting the Private Memory Limit or play around with the CPU Limit (throttling).

0 Votes 0 ·

1 Answer

SamWu-MSFT avatar image
0 Votes"
SamWu-MSFT answered SamWu-MSFT edited

Hi @Chad-2467

When the worker process exceeds the virtual memory limit, IIS will spin up a new worker process and kill the old one.

I think this is why the connection is reset, and you set the Virtual Memory Limit to 0, which means there is no limit to the virtual memory it can use, so the problem goes away.


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.