-
Notifications
You must be signed in to change notification settings - Fork 24
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
Worker service sometimes hangs at profiler startup #191
Comments
Hey @dolly22, thanks for filing the issue. Could you fill me in on why do you think the Profiler background service is blocking the whole host? By the callstack, it looks like the background service is running as expected. What do I miss? |
HI @xiaomi7732, thanks for your time looking into this.
The profiler is now starting on thread pool without blocking, and i did not encounter any further startup hangups in our test environment. I suspect the core issue might be something similar to dotnet/diagnostics#1060 (that blocking the host startup somehow causes no diagnostics events to be emitted and
The only problem with this workaround is that due to BTW: Thanks very much for implementing worker service support. Besides of this issue the profiler works wonderfully. Implementing support for profiling Orleans silo grain calls was pretty straight forward. I did have some issues when implementing support for profiling Service Bus message processing in our worker service, because ApplicationInsights tracking for Azure Sdk telemetry (Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule) internally does not |
Hey @dolly22 thanks for the detailed analysis. It didn't make sense to me until I see this line of code in our codebase: ...
await _orchestrator.StartAsync(cancellationToken).ConfigureAwait(true); // ConfigureAwait to true? Why? I am going to issue a PR:
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.Yield();
await _bootstrap.ActivateAsync(stoppingToken).ConfigureAwait(false);
} Thanks again for your report. |
Stable package released: |
Hello, I have implemented service profiler in worker service for Orleans silo grain calls based on #140. Sometimes i run into a problem that whole process just hangs up at startup. I tried to replicate this issue locally to create isolated repro, but was not yet successful. I do have stuck process memory dumps from our test environment. The application is hosted as ServiceFabric stateless service.
The process is stuck when the host is starting background services somewhere in
Microsoft.ApplicationInsights.Profiler.AspNetCore.dll!Microsoft.ApplicationInsights.Profiler.AspNetCore.ServiceProfilerBackgroundService.ExecuteAsync(System.Threading.CancellationToken stoppingToken)
I think this might have something to do with how ServiceProfilerBackgroundService.ExecuteAsync is implemented and when it truly becomes asynchronous (dotnet/runtime#36063).
This is a partial stacktrace of stuck startup thread:
The text was updated successfully, but these errors were encountered: