SamplingProfiler does not load on Alpine based linux image
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- java, linux
- 領域
- performance
調査の方向性
AsyncProfiler.java の AsyncProfiler.getInstance と loadNativeLibrary から始め、Alpine ベースのイメージで profiling_inferred_spans_enabled を有効にした場合の失敗を再現します。エージェントがネイティブライブラリをどのように選択するかを特定します。libasyncProfiler-linux-x64 ではなく MUSL ライブラリがロードされ、サンプリングプロファイラが 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
- フォーク
- 338
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 が 36 日前に担当しました。 オープンdocs good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
elastic/apm-agent-java#850 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Custom HttpURLConnection throwing unchecked exception can stall the agent対応中かも @jackshirazi が 7 日前に担当しました。 オープン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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/rocketmq-dashboard#6716 ·
メンテナーはふだん 3 日以内に返信
-
DefaultRedisList.get(int) does not reject an index equal to the list size対応中かも @ryujungkyun が今日担当しました。 オープンstatus: waiting-for-triage
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
spring-projects/spring-data-redis#3471 ·
メンテナーはふだん 5 日以内に返信
-
:maddi-inspection-kotlin:test runs out of heap in a full maddi test run; exit 1 with no failing testオープンbuild/ci front-end:kotlin
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
uwolfer/gerrit-intellij-plugin#768 ·
メンテナーはふだん 1 日以内に返信