SamplingProfiler does not load on Alpine based linux image
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java, linux
- 领域
- performance
调研方向
从 AsyncProfiler.java 中的 AsyncProfiler.getInstance 和 loadNativeLibrary 开始,然后在基于 Alpine 的镜像中启用 profiling_inferred_spans_enabled 以复现该故障。确定 agent 如何选择 native library;当加载的是 MUSL library 而不是 libasyncProfiler-linux-x64,并且 sampling profiler 在没有 UnsatisfiedLinkError 的情况下启动时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Enabling the sampling profiler on an Alpine based linux image results in a UnsatisfiedLinkError because libasyncProfiler-linux-x64 is loaded instead of the MUSL version.
Steps to reproduce
- Attach APM agent on Alpine based linux machine (in our case
eclipse-temurin:17-alpine) - Enable
profiling_inferred_spans_enabled
Results in:
java.lang.IllegalStateException: It is likely that /home/appuser/ is not an executable location. Consider setting the profiling_inferred_spans_lib_directory property to a directory on a partition that allows execution
at co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler.getInstance(AsyncProfiler.java:86) ~[elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
at co.elastic.apm.agent.profiler.SamplingProfiler.profile(SamplingProfiler.java:395) ~[elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
at co.elastic.apm.agent.profiler.SamplingProfiler.run(SamplingProfiler.java:376) [elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at co.elastic.apm.agent.util.ExecutorUtils$2.run(ExecutorUtils.java:99) [elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.UnsatisfiedLinkError: /home/appuser/libasyncProfiler-linux-x64-acb9b5f90d88f71f7c4eae5b818f1082-c6d96bf140e0562f0ce2765a99ced1c2.so: Error loading shared library libstdc++.so.6: No such file or directory (needed by /home/appuser/libasyncProfiler-linux-x64-acb9b5f90d88f71f7c4eae5b818f1082-c6d96bf140e0562f0ce2765a99ced1c2.so)
at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388) ~[?:?]
at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232) ~[?:?]
at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174) ~[?:?]
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) ~[?:?]
at java.lang.Runtime.load0(Runtime.java:755) ~[?:?]
at java.lang.System.load(System.java:1953) ~[?:?]
at co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler.loadNativeLibrary(AsyncProfiler.java:106) ~[elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
at co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler.getInstance(AsyncProfiler.java:84) ~[elastic-apm-agent-acb9b5f90d88f71f7c4eae5b818f1082-e6256b9ad98d9992211305097d439d61.jar:1.39.0]
... 9 more
Note that we're running with ENV LD_PRELOAD=/lib/libgcompat.so.0:/usr/lib/libunwind.so.8 because of a Netty native issue, without that you might get another exception
Expected behavior
Load the MUSL library. Either by detecting Alpine environment somehow or by adding a configuration option to instruct to load MUSL library version.
Debug logs
2023-07-03 08:27:15,716 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.39.0 as ** on Java 17.0.7 Runtime version: 17.0.7+7 VM version: 17.0.7+7 (Eclipse Adoptium) Linux 5.10.176+
2023-07-03 08:27:15,718 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - environment: 'NL-DEV' (source: /configuration/elasticapm.properties)
2023-07-03 08:27:15,720 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - config_file: '/configuration/elasticapm.properties' (source: Environment Variables)
2023-07-03 08:27:15,721 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - plugins_dir: '/home/appuser/apm-plugins' (source: Environment Variables)
2023-07-03 08:27:15,721 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - activation_method: 'PROGRAMMATIC_SELF_ATTACH' (source: Attachment configuration)
2023-07-03 08:27:15,722 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - secret_token: 'XXXX' (source: /configuration/elasticapm.properties)
2023-07-03 08:27:15,723 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - server_urls: '**' (source: /configuration/elasticapm.properties)
2023-07-03 08:27:15,725 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - application_packages: 'io.h4h' (source: /configuration/elasticapm.properties)
2023-07-03 08:27:15,725 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - profiling_inferred_spans_enabled: 'true' (source: Attachment configuration)
2023-07-03 08:27:15,726 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - profiling_inferred_spans_lib_directory: '/home/appuser/' (source: Attachment configuration)
- 主要语言
- Java
- 星标
- 593
- 派生
- 337
- 平均合并
- 15 小时 24 分钟
- 30 天内合并 PR
- 15
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
elastic/apm-agent-java 的其他 Issue
-
agent-java
难度 2/5 1-2 天 新手友好度 62/100
elastic/apm-agent-java#2844 · 2 条评论 ·
维护者通常 1 天内回复
-
Improve docs and add error log related to illegal activation of transaction可能已有人在做 @AzazelSensei 于 34 天前认领。 未关闭docs good first issue
难度 2/5 1-3 小时 新手友好度 68/100
elastic/apm-agent-java#850 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Custom HttpURLConnection throwing unchecked exception can stall the agent可能已有人在做 @jackshirazi 于 5 天前认领。 未关闭agent-java bug
elastic/apm-agent-java#4590 · 已指派 1 人 ·
维护者通常 1 天内回复
-
agent-java community triage
elastic/apm-agent-java#4573 · 4 条评论 ·
维护者通常 1 天内回复
-
agent-java
难度 4/5 3-5 天 新手友好度 55/100
elastic/apm-agent-java#4549 ·
维护者通常 1 天内回复
查看 elastic/apm-agent-java 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
ShaftHQ/SHAFT_ENGINE#6909 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
mudler/parakeet.cpp#99 ·
维护者通常 1 天内回复
-
[BUG] Re-subscribing the Mono returned by listTools/listResources/listResourceTemplates/listPrompts/listRoots duplicates the results可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/java-sdk#1174 · 1 个 reaction ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
baomidou/mybatis-plus#7185 ·
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
refinedmods/refinedstorage2#1419 ·