Profiling requires that the async-profiler shared library is exported to a temporary location and loaded by the JVM. This can fail due to /tmp partition restrictions or missing system libraries.

Symptoms

You may see errors similar to:
This typically happens when:
  • The /tmp partition is mounted with noexec flag
  • Security policies prevent execution from temporary directories
  • Container environments with restricted /tmp permissions
  • The libstdc++ library is missing in the Docker/container image

Solution

Fix 1: Non-executable /tmp partition

If /tmp is not executable, set the trace_spans_lib_directory property to an alternative directory that allows execution (e.g., /opt/atatus).

Step 1: Create the directory and set permissions

The directory must exist and be executable before the application starts.
For Docker images, add this to your Dockerfile:

Step 2: Configure the agent

If unset, the value of the java.io.tmpdir system property will be used.

Fix 2: Missing libstdc++ on Alpine Linux

If you are using an Alpine-based Docker image (e.g., eclipse-temurin:17-jre-alpine), the error may occur because Alpine uses musl libc instead of glibc. The async-profiler requires libstdc++ which is not included by default in Alpine. The key indicator is this error message:
Install the required libraries by adding this to your Dockerfile:
  • libstdc++: Required by the async-profiler
  • gcompat: glibc compatibility layer for Alpine
Example Dockerfile:
Alternative: If you want to avoid native library issues entirely, use a glibc-based image like eclipse-temurin:17-jre-jammy instead of Alpine.

Configuration Reference