-
-
Notifications
You must be signed in to change notification settings - Fork 226
Description
Description
We currently dispose the backpressure monitor here:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Line 873 in 04c932b
| _backpressureMonitor?.Dispose(); |
That gets passed into the Client:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Line 71 in 04c932b
| client ??= new SentryClient(options, randomValuesFactory: _randomValuesFactory, sessionManager: _sessionManager, backpressureMonitor: _backpressureMonitor); |
... and thus eventually into the Transport:
| var transport = _options.Transport ?? new LazyHttpTransport(_options, _backpressureMonitor); |
However we intentionally leave the client dangling when we dispose of the Hub... so that it can continue to receive requests from things that are wrapping up during application shutdown.
But if the Client and the Transport don't get disposed of when the Hub is, that could result in an ObjectDisposedException here:
sentry-dotnet/src/Sentry/SentryClient.cs
Line 381 in fc117ae
| var downsampledRate = sampleRate * _backpressureMonitor.GetDownsampleFactor(); |
Instead, we should maybe tell the worker task to exit by cancelling it's token and then just let the backpressure monitor dangle and hang out with the client until GC decides to nuke them.
Metadata
Metadata
Assignees
Labels
Projects
Status