DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
453 stars 140 forks source link

[Profiler] Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so #3218

Open seanamos opened 2 years ago

seanamos commented 2 years ago

On a M1 Pro Macbook in docker with mcr.microsoft.com/dotnet/aspnet:6.0.9-alpine3.16 as a base image.

If LD_PRELOAD=/opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so is set, attempting to do anything with the container results in:

Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 7
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 7
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 7
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 7
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 8
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 6
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 6
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 6
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 6
Error relocating /opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so: unsupported relocation type 6

Runtime environment:

Workaround is to conditionally set LD_PRELOAD.

gleocadie commented 2 years ago

Hello @seanamos

Thanks for reporting it.

What artifact did you download ? the ARM64 one or the other ?

According to the error, you might be using the non-ARM64 artifact on ARM64.

For your information, the profiler is deactivated today on ARM64. The stack collection is not ready yet.

seanamos commented 2 years ago

I used the musl artifact as its an alpine container: https://github.com/DataDog/dd-trace-dotnet/releases/download/v2.14.0/datadog-dotnet-apm-2.14.0-musl.tar.gz

I haven't tested yet with: https://github.com/DataDog/dd-trace-dotnet/releases/download/v2.14.0/datadog-dotnet-apm-2.14.0.arm64.tar.gz

EDIT: I'm aware profiling is de-activated on ARM64 at the moment due to the issue with stacktraces.

seanamos commented 2 years ago

Switching to https://github.com/DataDog/dd-trace-dotnet/releases/download/v2.14.0/datadog-dotnet-apm-2.14.0.arm64.tar.gz has other issues.

LD_PRELOAD doesn't immediately cause problems, however I get a segfault if I try start a dotnet app with:

ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so

This isn't an immediate blocker for us, however we are exploring running our dotnet alpine containers on AWS Graviton instances in the future.

gleocadie commented 2 years ago

Hi @seanamos I see. I'll do some testing, but I think we miss an artifact Alpine/ARM64 that would explain why it's not working for you. I'll get back to you.

Baune8D commented 1 year ago

Also seeing the same problem as @seanamos, trying to run a .NET 6 application on mcr.microsoft.com/dotnet/aspnet:6.0.13-alpine3.17-arm64v8 casuses the application to immediately crash with a Segmentation Fault. The continuousprofile folder only contains Datadog.Linux.ApiWrapper.x64.so

seanamos commented 1 year ago

@gleocadie Any progress on this? While this wasn't a big deal 6 months ago, its becoming more urgent for us.