ChaseMedallion
ChaseMedallion

Reputation: 21764

conhost.exe seemingly leaking memory

I have a .NET Framework ASP.NET application running in IIS. The application launches a long-lived sub-process but is otherwise unremarkable (just one endpoint which effectively proxies requests to the sub-process).

While the system is serving requests, the memory usage for conhost.exe on the machine steadily rises (~linear growth); after about a day it will be consuming .5-1 GB. Every 29 hours, the IIS application pool automatically recycles itself; at this point the conhost usage drops back to zero but then starts steadily growing again.

What could cause conhost to use this much memory?

UPDATE:

I saw that the settings for Console.BufferWidth and Console.BufferHeight can lead to more memory usage in conhost.exe. Therefore, I added logging for these values. However, my app shows a constant small buffer width and height.

UPDATE:

Per @simon-mourier's comment we pulled the dlls attached to the conhost process. All are in System32. The list is: conhost, ntdll, kernel32, kernelbase, msvcrt, Conhostv2, combase, ucrtbase, RPCRT4, bcryptPrimitives, GDI32, gdi32full, USER32, win32u, IMM32, OLEAUT32, msvcp_win, PROPSYS, sechost, shcore, SHELL32, cfgmgr32, windows.storage, powerprof, advapi32, shlwapi, kernel.appcore, and profapi.

UPDATE:

Seems similar to (if not the same as) ASP.NET Core ILogger Memory Leak on Windows 10 (1607) / Windows Server 2016 . Unfortunately that also lacks answers.

Upvotes: 4

Views: 1550

Answers (1)

ChaseMedallion
ChaseMedallion

Reputation: 21764

This turned out to be a Windows OS bug. We contacted Microsoft support about the issue and received a patch (likely the same patch mentioned by @sky in stackoverflow.com/a/68577179/779506).

Upvotes: 1

Related Questions