elastic / apm-agent-php

Apache License 2.0
252 stars 69 forks source link

segfault et. al when running on ARM #1131

Closed klingenm closed 3 days ago

klingenm commented 7 months ago

Describe the bug When running module on ARM, the module causes;

To Reproduce Steps to reproduce the behavior:

  1. build using BUILD_ARCHITECTURE=linux-arm64 make -f .ci/Makefile build
  2. fix the packaging script to support arm
diff --git a/packaging/Makefile b/packaging/Makefile
index d71784f..dfa5b49 100644
--- a/packaging/Makefile
+++ b/packaging/Makefile
@@ -8,6 +8,7 @@ PHP_AGENT_DIR:=/opt/elastic/apm-agent-php
PHP_VERSION?=7.2
GIT_SHA?=$(shell git rev-parse HEAD || echo "unknown")
RELEASE_VERSION?=
+BUILD_ARCH?=x86-64
GITHUB_RELEASES_URL=https://github.com/elastic/apm-agent-php/releases/download
export FPM_FLAGS=

@@ -40,7 +41,7 @@ create-%: prepare  ## Create the specific package
-e OUTPUT=$(OUTPUT) \
-e FPM_FLAGS=${FPM_FLAGS} \
-e PHP_AGENT_DIR=${PHP_AGENT_DIR} \
-               -e BUILD_ARCH=x86-64 \
+               -e BUILD_ARCH=${BUILD_ARCH} \
                -w /app $(IMAGE)
        @echo "::endgroup::"
  1. Then make -C packaging rpm BUILD_ARCH=arm64 PHP_VERSION=8.1
  2. Install it somehwere and run your app
  3. see all errors above

Expected behavior

Expect APM events be sent to server.

I did see the comments build but there is also no information on when/if/ever this will be supported.

Should I give up trying to use Elastic Observability if I wanna run my stuff on ARM?

klingenm commented 7 months ago

To be completely honest; I actually only got SIGSEGV and corrupted size vs. prev_size when running using the commands above. I also created a custom build image using quay.io/centos/centos:stream9instead of the soon-to-be-dead centos:7. I did this to make sure it was not some obscure backwards compatibility issue with glibc between the versions in centos:7 and fedora:39 (what I'm running my stuff in right now).

intuibase commented 6 months ago

Hey @klingenm

Thank you for feedback. The reason why we choose centos 7 was glibc backward compatibility. It is compatible with newer versions. Anyway, I was working on ARM build but didn't merged it yet, however I will share libraries built on github workflow I developed (https://github.com/intuibase/apm-agent-php/tree/poc_arm_build). I'll appreciate if you could download and test them on your setup. You can find them here: https://drive.google.com/drive/folders/1U_7YgmBAeMGgNA2em5z_NJdQJLz-ZEYp?usp=sharing

klingenm commented 6 months ago

I'm not able to load those extensions, used file to check and:

# file /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
/opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=a62090a4464109fe578589a31c95a5d12e753a15, stripped

looks like you sent me x86 modules @intuibase .

intuibase commented 6 months ago

Hey @klingenm

I'm sorry I mixed up the files. I decided to update ARM branch and run new build - please try out new files. They're compatible with master, please get PHP part from there of from this branch of my fork

klingenm commented 6 months ago

@intuibase I'll have a look when I get time. I think it will not be until next week.

intuibase commented 6 months ago

Hey @klingenm Have you been able to run tests?

SergeyKleyman commented 5 months ago

Hi @klingenm . Are you still interested in continuing to work on this feature?

fgdeveloper commented 5 months ago

Hi, sorry to interfere, but I've been following this issue for a while.

I've compliled the poc_arm_build using the @intuibase fork setup and it's currently deployed and working in AWS Fargate graviton containers running Alpine, successfully reporting to ElasticCloud.

Arm64 support would be greatly appreciated; the effort is already done by @intuibase so having it merged seems like a quick win for the product and the community.

Thanks!

intuibase commented 3 days ago

Hey all, @klingenm @fgdeveloper @patrikalienus We just released APM agent v1.14.0 with experimental support for ARM64. Please try it out and let us know it it works for you.