# AARCH64 APM Java Client Support

**URL:** <https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714>\
**Category:** APM\
**Tags:** java\
**Created:** [October 12, 2020, 5:33am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714 "2020-10-12T05:33:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![likewhatevs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/likewhatevs/32/77157_2.png) [@likewhatevs](https://discuss.elastic.co/u/likewhatevs)\
**Post date:** [October 12, 2020, 5:33am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/1 "2020-10-12T05:33:02Z")

</div>

**Kibana version** : latest on ECS

**Elasticsearch version** : latest on ECS

**APM Server version** : latest on ECS

**APM Agent language and version** : 1.18.1

**Steps to reproduce** :

1. try and run a jar with APM client on a aarch64 box (such as AWS c6g/r6g/m6g instances)

**Provide logs and/or server output (if relevant)**:

```auto
java.lang.IllegalStateException: It is likely that /usr/bin 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:77) ~[?:?]
	at co.elastic.apm.agent.profiler.SamplingProfiler.profile(SamplingProfiler.java:386) ~[?:?]
	at co.elastic.apm.agent.profiler.SamplingProfiler.run(SamplingProfiler.java:367) [?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	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:1130) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
	at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.UnsatisfiedLinkError: /usr/bin/libasyncProfiler-linux-arm-672c6dfb97228a24cd9de46d11a995ed.so: /usr/bin/libasyncProfiler-linux-arm-672c6dfb97228a24cd9de46d11a995ed.so: wrong ELF class: ELFCLASS32 (Possible cause: can't load ARM .so on a AARCH64 platform)
	at java.lang.ClassLoader$NativeLibrary.load0(Native Method) ~[?:?]
	at java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2452) ~[?:?]
	at java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2508) ~[?:?]
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2704) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2637) ~[?:?]
	at java.lang.Runtime.load0(Runtime.java:745) ~[?:?]
	at java.lang.System.load(System.java:1871) ~[?:?]
	at co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler.loadNativeLibrary(AsyncProfiler.java:98) ~[?:?]
	at co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler.getInstance(AsyncProfiler.java:75) ~[?:?]
	... 8 more

```

---

<div class="post-metadata">

**Author:** ![likewhatevs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/likewhatevs/32/77157_2.png) [@likewhatevs](https://discuss.elastic.co/u/likewhatevs)\
**Post date:** [October 12, 2020, 5:38am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/2 "2020-10-12T05:38:52Z")

</div>

> <https://github.com/elastic/apm-agent-java/blob/951b5fff8863a7d1a0816c43b16ac920006e315c/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/asyncprofiler/AsyncProfiler.java#L101>

fix would be adding another library to that, compiled on a aarch64 chip

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [October 12, 2020, 7:26am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/3 "2020-10-12T07:26:58Z")

</div>

Did you try the suggested solution? -

> [@likewhatevs](#):
>
> ```auto
> java.lang.IllegalStateException: It is likely that /usr/bin is not an executable location. Consider setting the profiling_inferred_spans_lib_directory property to a directory on a partition that allows execution
> 
> ```

See [`profiling_inferred_spans_lib_directory`](https://www.elastic.co/guide/en/apm/agent/java/current/config-profiling.html#config-profiling-inferred-spans-lib-directory) for details.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [October 12, 2020, 9:33am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/4 "2020-10-12T09:33:42Z")

</div>

Also, did you enabled the sampling profiler using the [profiling\_inferred\_spans\_enabled](https://www.elastic.co/guide/en/apm/agent/java/current/config-profiling.html#config-profiling-inferred-spans-enabled) option or did you used the default settings ?

---

<div class="post-metadata">

**Author:** ![likewhatevs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/likewhatevs/32/77157_2.png) [@likewhatevs](https://discuss.elastic.co/u/likewhatevs)\
**Post date:** [October 12, 2020, 12:03pm UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/5 "2020-10-12T12:03:39Z")

</div>

> Did you try the suggested solution? -

Yes.

After trying a few directories I knew to be executable and getting that same message (the default was `/tmp`), I noticed the following in that stack trace:

```auto
Caused by: java.lang.UnsatisfiedLinkError: /usr/bin/libasyncProfiler-linux-arm-672c6dfb97228a24cd9de46d11a995ed.so: /usr/bin/libasyncProfiler-linux-arm-672c6dfb97228a24cd9de46d11a995ed.so: wrong ELF class: ELFCLASS32 (Possible cause: can't load ARM .so on a AARCH64 platform)

```

---

<div class="post-metadata">

**Author:** ![likewhatevs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/likewhatevs/32/77157_2.png) [@likewhatevs](https://discuss.elastic.co/u/likewhatevs)\
**Post date:** [October 12, 2020, 12:04pm UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/6 "2020-10-12T12:04:13Z")

</div>

This is enabled via `ELASTIC_APM_PROFILING_INFERRED_SPANS_ENABLED=true`.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [October 14, 2020, 8:20am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/7 "2020-10-14T08:20:14Z")

</div>

Thanks for reporting this, [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) should support aarch64, thus I've opened [an issue](https://github.com/elastic/apm-agent-java/issues/1439). You can subscribe to it for updates.

Also which OS/distribution are you using ? That might be useful to help reproduce it.

---

<div class="post-metadata">

**Author:** ![likewhatevs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/likewhatevs/32/77157_2.png) [@likewhatevs](https://discuss.elastic.co/u/likewhatevs)\
**Post date:** [October 14, 2020, 9:27am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/8 "2020-10-14T09:27:28Z")

</div>

> Thanks for reporting this, [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) should support aarch64, thus I've opened [an issue](https://github.com/elastic/apm-agent-java/issues/1439). You can subscribe to it for updates.  
> Thanks!

> Also which OS/distribution are you using ?  
> Amazon Linux 2

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [October 15, 2020, 2:30pm UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/9 "2020-10-15T14:30:17Z")

</div>

Also, could you try to use the standalone [async-profiler](https://github.com/jvm-profiling-tools/async-profiler#download) directly to see if that makes a difference ?

Trying both `arm` and `musl` variants sounds relevant in this case.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [October 19, 2020, 12:52pm UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/10 "2020-10-19T12:52:57Z")

</div>

@likewhatevs Please download [this snapshot build](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/PR-1443/3/artifacts) and see if you can use the sampling profiler on your aarch64 box with it.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [October 22, 2020, 11:34am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/11 "2020-10-22T11:34:19Z")

</div>

@likewhatevs Did you have a chance to test it?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [October 22, 2020, 12:39pm UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/12 "2020-10-22T12:39:17Z")

</div>

Better test [this snapshot](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/PR-1443/5/pipeline), where I applied a minor change to the OS architecture lookup.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 12, 2020, 8:39am UTC](https://discuss.elastic.co/t/aarch64-apm-java-client-support/251714/13 "2020-11-12T08:39:25Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
