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

OperationCancelledException in debug output with multiple sentry instances #1372

Open
TheArcaneBrony opened this issue Dec 6, 2021 · 3 comments
Labels
ASP.NET Core Bug Something isn't working

Comments

@TheArcaneBrony
Copy link

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.```
@bruno-garcia
Copy link
Member

bruno-garcia commented Dec 6, 2021

This is related to an issue @SimonCropp is addressing on #1354

@bruno-garcia bruno-garcia added ASP.NET Core Bug Something isn't working labels Dec 6, 2021
@bruno-garcia
Copy link
Member

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 IDisposables 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

@SimonCropp
Copy link
Contributor

@TheArcaneBrony given the above linked changes, would you be able to update and check if the problem still exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASP.NET Core Bug Something isn't working
Projects
Status: No status
Archived in project
Development

No branches or pull requests

5 participants