apache/cassandra · error · IllegalStateException

Async profiler not available.

Error message

Async profiler not available.

What it means

run() checks that the AsyncProfiler instance was successfully obtained at service construction (via getProfiler). If asyncProfiler is null — i.e. the profiler library could not be attached — any start/stop/execute/status call throws IllegalStateException('Async profiler not available.').

Solutions

  1. Verify the async-profiler native library is installed and loadable by the JVM (check LD_LIBRARY_PATH / -agentpath)
  2. Ensure the node was started with the async profiler agent attached
  3. Call AsyncProfilerService.reset()/reinitialize in tests before exercising the service
  4. Check startup logs for the original AsyncProfiler.getInstance() failure
Defensive patterns

Strategy: try-catch

Try / catch

try { service.execute(cmd); } catch (IllegalStateException e) { if (e.getMessage().contains("not available")) { fallbackToLocalDiagnostics(); return; } throw e; }

Prevention

When it happens

Trigger: Calling any AsyncProfilerService operation when the AsyncProfiler instance failed to initialize (e.g. libasyncProfiler.so could not be loaded at JVM startup), even with the feature enabled.

Common situations: Async profiler agent library missing from the library path or wrong architecture; feature flag enabled but the native agent never attached; tests that did not call reset()/initialize the profiler.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/a8db318c3f5deaa8. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/AsyncProfilerService.java:507

            throw new IllegalStateException("Async Profiler is not enabled. Enable it by setting " + ASYNC_PROFILER_ENABLED.getKey() +
                                            " property to true.");
        if (asyncProfiler != null)
        {
            try
            {
                return f.apply(asyncProfiler);
            }
            catch (IllegalStateException | IllegalArgumentException t)
            {
                throw t;
            }
            catch (Throwable t)
            {
                throw new RuntimeException(t);
            }
        }
        else
            throw new IllegalStateException("Async profiler not available.");
    }

    public abstract static class ThrowingFunction<A, B>
    {
        public abstract B apply(AsyncProfiler a) throws Throwable;
    }

    private AsyncProfiler getProfiler()
    {
        if (!ASYNC_PROFILER_ENABLED.getBoolean())
            return null;

        if (asyncProfiler != null)
            return asyncProfiler;

        try
        {
            asyncProfiler = AsyncProfiler.getInstance();

View on GitHub (pinned to 88fd0f6a0e)