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

Potential memory leak of DiagnosticListener - .NET Framework app on Azure App Service #2033

Closed
jirikanda opened this issue Sep 7, 2020 · 5 comments
Labels

Comments

@jirikanda
Copy link

I am creating a separate issue from #1867 to better target issue to the .NET Framework.

Environment

  • SDK version: 2.14.0
  • .NET runtime version (.NET Framework 4.7.2)
  • Hosting Info (IIS/Azure WebApps/etc): Azure App Service
  • Platform and OS version: Windows

What is the expected behavior?
GC able to reclaim memory.

What is the actual behavior?
Number of DiagnosticSubscriptions grows in time.

The are two images below:

  • Memory consumption of our applications in time (more than two weeks).
  • Memory dump analysis (debug) in Visual Studio 2019 of the application.

memoryconsumption
memorydebug

@jirikanda jirikanda added the bug label Sep 7, 2020
@github-actions
Copy link

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Sep 15, 2021
@jirikanda
Copy link
Author

Yes, good tactic.
No reaction. Autoclose. Solved.

Sad world.

@TimothyMothra
Copy link
Member

Hello @jirikanda, I'm sorry this issue was overlooked when it was opened.

Do you have a repro for this issue? This would help us investigate and collect more data.

If not, you can create an Azure Support Request and one of our engineers can help collect a dump from your environment.

@cijothomas
Copy link
Contributor

From a quick look, it looks like a code issue as it shows many instances of TelemetryClient itself. Please share the code snippet used to enable application insights, and we can review if it is correct.

@github-actions github-actions bot removed the stale label Sep 16, 2021
@jirikanda
Copy link
Author

To be honest, we have mitigated the issue.

But be sure there is no code which is creating a new TelemetryClient instance. It is hidden somewhere in the Application Insights packages.

But what we did was creating a lot of Azure Blob Storage Client (BlobContainerClient) instances. When we change this behavior to have BlobContainerClient singleton, the issue was mitigated.
There were some issues here on github trying to explain this. I was trying to explain this bad behavior by impacts - reusing BlobContainerClient caused to double memory consumption by TelemetryClient & co. in a week or two.

I am not going to provide any snippet after a year. I also did not checked if the issue with BlobContainerClient was mitigated in the library. Hope, you are not solving the issue as "not out team issue" on both sides.

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

No branches or pull requests

3 participants