Open z1c0 opened 1 year ago
Further investigation showed that GcMetricsProvider
causes the problem.
Hence, the workaround can be narrowed down to disabling any GC-related metrics:
ELASTIC_APM_DISABLE_METRICS='clr.gc.*'
Could be related to https://github.com/dotnet/runtime/issues/53564
The specific line of code that causes the agent to hang is EnableEvents(eventSource, EventLevel.Informational, (EventKeywords)keywordGC);
in GcEventListener
.
APM Agent version
1.19.0
Environment
Operating system and version:
Linux Docker containers built with the .NET 7
publish
command (see here)..NET Framework/Core name and version:
.NET 7
Describe the bug
When injecting the agent into a Docker container build with the
publish
command, the agent does not start up any more.Other agent injection methods are probably affected as well but have not been tested yet.
To Reproduce
Steps to reproduce the behavior:
DOTNET_STARTUP_HOOKS
method.Elastic.Apm.StartupHook.Loader.Loader.Initialize
.Output:
Workaround
Initial research showed that the agent's metric collection initialization in the
MetricsCollector
constructor is the point where the agent hangs. Disabling the agent's metric collection viaELASTIC_APM_METRICS_INTERVAL=0
prevents the hang.