-
-
Notifications
You must be signed in to change notification settings - Fork 226
fix: memory leak when finishing unsampled Transactions/Spans #4717
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
Conversation
|
@sentry review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## version6 #4717 +/- ##
===========================================
Coverage ? 73.26%
===========================================
Files ? 480
Lines ? 17432
Branches ? 3439
===========================================
Hits ? 12771
Misses ? 3815
Partials ? 846 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| private void ReleaseSpans() | ||
| { | ||
| #if NETSTANDARD2_1_OR_GREATER | ||
| #if NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: use Clear on .NET Core and .NET TFMs as well
Previously, only netstandard2.1 was using Clear.
But the ConcurrentBag.Clear Method is also available since netcoreapp2.0, and with that, also since net5.0.
jamescrosswell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Fixes #4709
Similar to #3432,
but for the newer types
UnsampledTransactionandUnsampledSpan.With the reproduction code from the related issue (see #4709):
Before

After

Also verified against
Sentry.Samples.AspNetCore.Basic:options.AutoRegisterTracing = false;options.TracesSampleRate = 1.0;andoptions.TracesSampleRate = 0.0;SentryTracingMiddlewareis already finishing the Transactions, hence now also releasing the tracked Spanssentry-dotnet/src/Sentry.AspNetCore/SentryTracingMiddleware.cs
Lines 144 to 149 in 2a3bf15