{"record":{"id":"80ef471b4def1b0e","repo":"apache/cassandra","slug":"unable-to-get-an-instance-of-async-profiler","errorCode":null,"errorMessage":"Unable to get an instance of Async-Profiler","messagePattern":"Unable to get an instance of Async-Profiler","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AsyncProfilerService.java","lineNumber":530,"sourceCode":"        public abstract B apply(AsyncProfiler a) throws Throwable;\n    }\n\n    private AsyncProfiler getProfiler()\n    {\n        if (!ASYNC_PROFILER_ENABLED.getBoolean())\n            return null;\n\n        if (asyncProfiler != null)\n            return asyncProfiler;\n\n        try\n        {\n            asyncProfiler = AsyncProfiler.getInstance();\n            return asyncProfiler;\n        }\n        catch (Throwable t)\n        {\n            throw new IllegalStateException(\"Unable to get an instance of Async-Profiler\", t);\n        }\n    }\n\n    @VisibleForTesting\n    public static void reset()\n    {\n        if (instance != null)\n            asyncProfiler = null;\n\n        instance = null;\n    }\n}\n","sourceCodeStart":512,"sourceCodeEnd":543,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AsyncProfilerService.java#L512-L543","documentation":"getProfiler wraps AsyncProfiler.getInstance() and converts any failure (missing native library, unsupported platform, attach error) into IllegalStateException('Unable to get an instance of Async-Profiler') with the original cause attached. This runs during AsyncProfilerService construction, so the service ends up with a null profiler.","triggerScenarios":"AsyncProfilerService construction when AsyncProfiler.getInstance() throws — typically because libasyncProfiler.so is not on the JVM library path, or the JVM/platform is unsupported.","commonSituations":"Installing Cassandra without the async-profiler native library; wrong library architecture (e.g. aarch64 lib on x86_64); JDKs where async-profiler attach is unsupported.","solutions":["Install the async-profiler native library matching the platform and make it loadable (java.library.path / LD_LIBRARY_PATH)","Check the chained cause ('Caused by') in the logs for the exact load failure","Disable async_profiler_enabled if profiling is not needed on this node","Confirm JDK compatibility with the installed async-profiler version"],"exampleFix":"// before (missing lib)\njava ... // no agentpath, getInstance() fails\n// after\njava -agentpath:/usr/lib/async-profiler/libasyncProfiler.so ...","handlingStrategy":"try-catch","validationCode":"try { Class.forName(\"one.profiler.AsyncProfiler\"); } catch (ClassNotFoundException e) { /* async-profiler jar not present */ }","typeGuard":null,"tryCatchPattern":"try { service.status(); } catch (IllegalStateException | RuntimeException e) { logger.error(\"Async profiler unusable: {}\", e.getMessage(), e.getCause()); }","preventionTips":["Install the async-profiler native library matching OS and CPU architecture","Pin and test the async-profiler version with your JDK in CI images","Read the chained 'Caused by' to distinguish missing-library vs unsupported-JVM causes"],"tags":["profiling","initialization","native-library"],"backgroundTag":"module-init-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}