-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
I honestly am at a complete loss and not sure where to go to log this issue I am having, but I will try my best to provide information and I hope someone can help guide me.
We published a Net Core 3.1 API on an internal Windows Server 2019 machine. We setup a new machine (fresh install). The exact API ran previously on Windows Server 2016.
However we noticed that there was some serious issues on the new server. We could not remote and the API was not accessible.
Finally we managed to see what was happening:
The w3wp.exe
process that hosted the AspNet API looked to be stuck and permanently allocating memory. So much so that there was no memory left for anything else, effectively taking the server offline. It also seemed to be doing some processing on the SQL Server Express instance that was also installed on that machine, but the traces we ran of what SQL was running did not point us in any relevant direction.
Restarting the IIS App Pool did not immediately stop the problem as the process continued to spin away. Eventually the rogue process would stop and we could regain control of the server.
Now we removed so much of our code to try and establish where the problem was to no avail. And unfortunately it has led me here seeking some help.
One thing that we did find in our efforts to fix this was that if we run OutOfProcess
the issue vanishes. The second we run InProcess
, the process will run out of control at some point in time (probably like 2-4 times a day).
Now this does not happen as soon as the process has started. But seems to occur randomly - I am not able to trace any specific API that is called (as they have all been disabled). The API really is simple, just a bunch of Controllers that query SQL. The process will respond and serve traffic like normal, and then you go for a jog and the next thing you know your phone is blowing up because things are not working. This inconsistency is extremely stressful. However I did find that when I restart the server and then remote onto it, the process has a tenancy to start going crazy.
I do not know what traces or debug things to run or how to further resolve this issue. Sorry I know this may not be the right place and I have tried to explain my story. It is hard to do huge amounts of diagnostics on a live server but I am willing to try get to the bottom of it. I am hoping there is some strange config somewhere...?
To summarise:
- API
w3wp
process spins up a core and allocates huge amounts of memory making the host unresponsive. - Did not happen prior to running on Windows Server 2019.
- Does not occur when the hosting model is set to
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
onlyInProcess
Further technical details
Looks to be using Workstation GC - Using Server GC makes no difference.
- ASP.NET Core version 3.1
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]