sentry-dotnet
sentry-dotnet copied to clipboard
OperationCancelledException in debug output with multiple sentry instances
Environment
How do you use Sentry? Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?)
Sentry on-premise 3.11.0, used for performance and error logging
Which SDK and version? e.g: JavaScript 5.11.1, .NET 1.2.0 .NET 6.0, Sentry.AspNetCore 3.11.0
Steps to Reproduce
Run multiple instances of asp.net core's web server.
Expected Result
Sentry reports data for all instances
Actual Result
Sentry throws System.OperationCancelledException:
Sentry.ISentryClient: Information: Disposing the Hub.
Exception happened: System.OperationCanceledException
at Sentry.Internal.BackgroundWorker.WorkerAsync() in /_/src/Sentry/Internal/BackgroundWorker.cs:line 90
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.CancellationCleanupLogic()
at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at System.Threading.SemaphoreSlim.WaitUntilCountOrTimeoutAsync(TaskNode asyncWaiter, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Threading.Tasks.TaskScheduler.TaskSchedulerAwaiter.<>c.<UnsafeOnCompleted>b__6_0(Action s)
at System.Threading.QueueUserWorkItemCallbackDefaultContext`1.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Sentry.ISentryClient: Information: Exiting the worker with an empty queue.```
This is related to an issue @SimonCropp is addressing on #1354
It seems to be related to a known issue that ASP.NET Core intantiates more than one container.
Sentry.ISentryClient: Information: Exiting the worker with an empty queue.```
The first one eventually gets disposed, and so does all IDisposable
s it resolved. That includes IHub
and ISentryClient
. The Sentry SDK is initialized again so it should capture events later, but anything that was captured between the first and second container ends up hitting a disposed Hub/Client.
Related to: #599 #1354
@TheArcaneBrony given the above linked changes, would you be able to update and check if the problem still exists?
Closing this as stale. Please feel free to reply or reopen this issue if it persists for you.