Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asp.net core 3.1 issue with retained memory usage of AzureSdkDiagnosticsEventHandler & DiagnosticListener #2186

Closed
ojpbay opened this issue Mar 17, 2021 · 3 comments

Comments

@ojpbay
Copy link

ojpbay commented Mar 17, 2021

Runtime version: netcoreapp3.1 - 3.1.112
Build agents sdk: 3.1.404
Hosting environment: Azure app service

Nuget packages

  • AspNetCore.HealthChecks.AzureKeyVault" Version="3.1.1"
  • AspNetCore.HealthChecks.AzureServiceBus" Version="3.2.1"
  • AspNetCore.HealthChecks.AzureStorage" Version="3.2.0"
  • AspNetCore.HealthChecks.Publisher.ApplicationInsights" Version="3.1.1"
  • AspNetCore.HealthChecks.Network" Version="3.1.1"
  • AspNetCore.HealthChecks.SignalR" Version="3.1.1"
  • AspNetCore.HealthChecks.SqlServer" Version="3.1.1"
  • AspNetCore.HealthChecks.System" Version="3.1.2"
  • AspNetCore.HealthChecks.Uris" Version="3.1.2"
  • Dapper" Version="2.0.35"
  • MailKit" Version="2.6.0"
  • Microsoft.ApplicationInsights.AspNetCore" Version="2.17.0"
  • Microsoft.ApplicationInsights.WorkerService" Version="2.17.0"
  • Microsoft.AspNet.WebApi.Client" Version="5.2.7"
  • Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="3.1.3"
  • Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3"
  • Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3"
  • Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.3"
  • Microsoft.Azure.ServiceBus" Version="4.1.3"
  • Microsoft.Azure.Services.AppAuthentication" Version="1.4.0"
  • Microsoft.Azure.SignalR" Version="1.4.3"
  • Microsoft.CodeAnalysis.Common" Version="3.5.0"
  • Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.5.0"
  • Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3"
  • Microsoft.Extensions.Caching.StackExchangeRedis" Version="3.1.6"
  • Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.3"
  • Microsoft.Extensions.Logging.ApplicationInsights" Version="2.17.0"
  • Microsoft.Graph" Version="3.3.0"
  • Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9"
  • Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2"

We have a production web app that is exhibiting symptoms of a memory leak and this appears to be related to objects connected to ApplicationInsights.

sawtooth-memory

Having taken numerous memory dumps from the Azure app service (using JetBrains dotMemory) we can see a common theme that memory is being retained by a large number of objects.

retained-objects

Largest Retained Memory used by (in last test run, approx 25k) objects as below:

  • AzureSdkDiagnosticsEventHandler
  • DiagnosticListener
  • DiagnosticListener+DiagnosticSubscription
@ojpbay ojpbay added the bug label Mar 17, 2021
@gocha
Copy link

gocha commented Oct 20, 2021

Experiencing the same issue. I am using the following NuGet package.

  • Azure.Storage.Blobs 12.9.1
  • Azure.Storage.Queues 12.7.0
  • Azure.Security.KeyVault.Keys 4.1.0

@gocha
Copy link

gocha commented Oct 20, 2021

This problem is probably the same as Azure/azure-sdk-for-net#18199 and #1867. And my problem has been solved.

I was creating new instances of CryptgraphyClient each time I wanted to perform client-side encryption of a blob using a number of different encryption keys, but when I changed the code to reuse instances as much as possible, the problem went away.

@github-actions
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants