elastic / apm-agent-dotnet

https://www.elastic.co/guide/en/apm/agent/dotnet/current/index.html
Apache License 2.0
573 stars 205 forks source link

[BUG] Auto-instrumentation using the profiler-based agent installation fails inside Docker containers since 1.23.0 #2383

Closed stevejgordon closed 18 hours ago

stevejgordon commented 6 days ago

When building a container image containing the profiler agent for auto-instrumentation of ASP.NET Core applications, the agent is no longer working. No logs appear from the profiler, suggesting that this fails extremely early when the CLR attempts to load the profiler. We see no obvious logs from the .NET runtime to identify the reason for the failure.

We need to identify what changed between 1.22.0 and 1.23.0 that may have caused this. No obvious changes were made to the managed profiler code.

stevejgordon commented 5 days ago

I've included a sample that can be used to reproduce this by building images for various combinations of agent version and .NET runtime. The README contains details of the steps to use it.

stevejgordon commented 5 days ago

After testing this in several combinations, the latest agent seems to work on a .NET 8.0 container.

Runtime Version Agent Version Working (Y/N)
8.0 1.27.3 Y
7.0 1.27.3 N
6.0 1.27.3 N
8.0 1.22.0 Y
7.0 1.22.0 Y
6.0 1.22.0 Y
6.0 1.23.0 N
6.0 Custom local build N
stevejgordon commented 5 days ago

As yet untested in Linux outside of a container scenario.

stevejgordon commented 1 day ago

On initial testing on a Debian 11 VM, 1.27.3 failed on .NET 6.0 and .NET 8.0. This is strange, as I had it working in a container. 1.22.0 seemed to work fine.

stevejgordon commented 1 day ago

We have identified the root cause and hope to have a fix soon.