microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation
MIT License
66 stars 23 forks source link

Application Profiler Uploader not working in .NET 6 Preview (on Azure App Service Linux Container) #149

Closed AAimson closed 2 years ago

AAimson commented 2 years ago

Hello šŸ‘‹ ,

I'm running into issues when running App Insights Profiler in a Linux Container Azure App Service

Currently unable to upload the logs.

Running .NET 6 RC2 project reference, FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.2-focal AS base

Referencing:

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.19.0-beta1"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0-beta1"/>
<PackageReference Include="Microsoft.ApplicationInsights.Profiler.AspNetCore" Version="2.3.1-beta2"/>
2021-11-07T19:20:25.447534596Z [19:20:25 INF] Uploader to be used: /tmp/ServiceProfiler/2.6.2111.401/Uploader/Microsoft.ApplicationInsights.Profiler.Uploader.dll
 It was not possible to find any compatible framework version
 The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
   - The following frameworks were found:
       6.0.0-rc.2.21480.5 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

 You can resolve the problem by installing the specified framework and/or SDK.

 The specified framework can be found at:
   - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=ubuntu.20.04-x64
 [19:20:25 INF] Finished calling trace uploader. Exit code: 150
 [19:20:25 ERR] Trace upload failed. Exit code: 150
 [19:20:55 ERR] Unexpected error happens on stopping service profiler.
 System.OperationCanceledException: The operation was canceled.
    at System.Threading.CancellationToken.ThrowOperationCanceledException()
    at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
    at System.IO.Pipes.NamedPipeClientStream.<>c__DisplayClass20_0.<ConnectAsync>b__0()
    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
 --- End of stack trace from previous location ---
    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.IPC.DuplexNamedPipeService.ConnectAsync(String pipeName, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.<>c__DisplayClass4_0.<<PostStopProcessAsync>b__0>d.MoveNext()
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.PostStopProcessAsync(PostStopOptions e, CancellationToken cancellationToken)
 [19:20:55 ERR] Unexpected error happens on stopping service profiler tracing.
 System.OperationCanceledException: The operation was canceled.
    at System.Threading.CancellationToken.ThrowOperationCanceledException()
    at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
    at System.IO.Pipes.NamedPipeClientStream.<>c__DisplayClass20_0.<ConnectAsync>b__0()
    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
 --- End of stack trace from previous location ---
    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.IPC.DuplexNamedPipeService.ConnectAsync(String pipeName, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.<>c__DisplayClass4_0.<<PostStopProcessAsync>b__0>d.MoveNext()
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.PostStopProcessAsync(PostStopOptions e, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.StopServiceProfilerAsync(IProfilerSource source, CancellationToken cancellationToken)
 [19:20:55 ERR] Unexpected exception in the last circle.
 System.OperationCanceledException: The operation was canceled.
    at System.Threading.CancellationToken.ThrowOperationCanceledException()
    at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
    at System.IO.Pipes.NamedPipeClientStream.<>c__DisplayClass20_0.<ConnectAsync>b__0()
    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
 --- End of stack trace from previous location ---
    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.IPC.DuplexNamedPipeService.ConnectAsync(String pipeName, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.<>c__DisplayClass4_0.<<PostStopProcessAsync>b__0>d.MoveNext()
 --- End of stack trace from previous location ---
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.PostStopProcessAsync(PostStopOptions e, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider.StopServiceProfilerAsync(IProfilerSource source, CancellationToken cancellationToken)
    at Microsoft.ApplicationInsights.Profiler.Core.Orchestration.OrchestratorEventPipe.StopProfilingAsync(SchedulingPolicy policy, CancellationToken cancellationToken)
    at Microsoft.ServiceProfiler.Orchestration.SchedulingPolicy.StartPolicyAsync(CancellationToken token)

Can you please advice?

xiaomi7732 commented 2 years ago

@AAimson Thanks for the report. Let me take a look.

xiaomi7732 commented 2 years ago

Hi @AAimson , do you mind try it with this environemnt variable in your container as a quick workaround:

DOTNET_ROLL_FORWARD:LatestMajor

I think I found out why and I need another release to fix the issue.

xiaomi7732 commented 2 years ago

The fix is released with 2.3.1-beta3. Please give it a try.