ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Potential net6 App Insights Memory Leak

Open Bharts8 opened this issue 3 years ago • 4 comments

  • List of NuGet packages and version that you are using: <PackageReference Include="Microsoft.ApplicationInsights" Version="2.19.0" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
  • Runtime version (e.g. net461, net48, netcoreapp2.1, netcoreapp3.1, etc. You can find this information from the *.csproj file): net6
  • Hosting environment (e.g. Azure Web App, App Service on Linux, Windows, Ubuntu, etc.): Azure Web App

Describe the bug

Created a net6 project hosted in Azure Web App to host a reasonably simple REST API. After running for about a day noticed extremely high memory usage akin to a memory leak application insights described in #1678 Was able to capture memory dump and find 26.5k long running net tasks seemingly coming from Microsoft.AI.PerfCounterCollector

image

image

Mitigated by using versions <PackageReference Include="Microsoft.ApplicationInsights" Version="2.11.0" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.2" />

Bharts8 avatar Dec 09 '21 22:12 Bharts8

Hi @BPHartel Can you share a minimal repro? This would allow us to collect a dump to investigate.

TimothyMothra avatar Dec 14 '21 18:12 TimothyMothra

I am also seeing this issue and it may prevent us from using App Insights

ercquest avatar Feb 09 '22 16:02 ercquest

Was able to capture memory dump and find 26.5k long running net tasks seemingly coming from Microsoft.AI.PerfCounterCollector

image

26564 is the thread ID, not the number of threads.

MisinformedDNA avatar Jun 10 '22 14:06 MisinformedDNA

I'm also seeing something similar while using Azure Functions, our App Service Plan memory usage slowly creeps up over time.

After talking with Azure support, they provided a system process graph showing "MeteringDotNetCore.dll" process with nearly 40% usage at the time of capture. The behavior suddenly started showing without any changes and suddenly stopped as well.

rgrace-puck avatar Sep 20 '22 14:09 rgrace-puck

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Jul 18 '23 00:07 github-actions[bot]