{"record":{"id":"c0ac4cfb7770c25b","repo":"apache/cassandra","slug":"async-profiler-experience-likely-affected-kernel","errorCode":null,"errorMessage":"Async-profiler experience likely affected. Kernel symbols are unavailable due to restrictions. Try 'sysctl kernel.perf_event_paranoid=1' and 'sysctl kernel.kptr_restrict=0' or its variation on your system to resolve the issue.","messagePattern":"Async-profiler experience likely affected\\. Kernel symbols are unavailable due to restrictions\\. Try 'sysctl kernel\\.perf_event_paranoid=1' and 'sysctl kernel\\.kptr_restrict=0' or its variation on your system to resolve the issue\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/StartupChecks.java","lineNumber":1166,"sourceCode":"        {\n            try\n            {\n                if (!CassandraRelevantProperties.ASYNC_PROFILER_ENABLED.getBoolean())\n                    return;\n\n                int perfEventParanoid = readPerfEventParanoid();\n                int kptrRestrict = readKptrRestrict();\n\n                if (perfEventParanoid == Integer.MIN_VALUE || kptrRestrict == Integer.MIN_VALUE)\n                {\n                    logger.debug(\"Unable to determine values for kernel parameter of \" +\n                                 \"'kernel.perf_event_paranoid' and 'kernel.kptr_restrict' for Async-profiler. \" +\n                                 \"Its usability might be limited.\");\n                }\n                else if (perfEventParanoid > 1 || kptrRestrict != 0)\n                {\n                    if (shouldThrow)\n                        throw new IllegalStateException(MESSAGE);\n                    else\n                        logger.warn(MESSAGE);\n                }\n            }\n            catch (Throwable t)\n            {\n                if (shouldThrow)\n                    throw t;\n            }\n        }\n\n        @Override\n        public void execute(StartupChecksConfiguration configuration)\n        {\n            execute(configuration, false);\n        }\n    }\n","sourceCodeStart":1148,"sourceCodeEnd":1184,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StartupChecks.java#L1148-L1184","documentation":"StartupChecks verifies kernel perf_event settings (perf_event_paranoid, kptr_restrict) when Async-profiler-based monitoring is available. If the kernel restricts access to kernel symbols or low-privilege profiling, Async-profiler cannot resolve kernel stack frames, so Cassandra throws IllegalStateException (or logs a warning) at startup to signal the profiling experience will be degraded.","triggerScenarios":"Node startup with Async-profiler enabled on a Linux host where perf_event_paranoid > 1 or /proc/sys/kernel/kptr_restrict != 0, i.e. the kernel blocks unprivileged kernel-level profiling and symbol resolution.","commonSituations":"Running Cassandra in default-hardened containers or distros where kptr_restrict=2 and perf_event_paranoid=2/3/4; running as non-root without CAP_PERFMON; newer kernels that raised the default paranoid level.","solutions":["Set kernel.perf_event_paranoid=1: sysctl -w kernel.perf_event_paranoid=1 (persist in /etc/sysctl.conf or /etc/sysctl.d/).","Set kernel.kptr_restrict=0: sysctl -w kernel.kptr_restrict=0 (or 1 with CAP_SYSLOG).","Run the Cassandra process with elevated profiling privileges (CAP_SYS_ADMIN / CAP_PERFMON) if sysctls cannot be changed.","If profiling is not needed, keep the warning level (don't force the check to throw) and accept reduced profiler fidelity."],"exampleFix":"// before (host kernel settings)\nkernel.perf_event_paranoid = 3\nkernel.kptr_restrict = 2\n// after\nkernel.perf_event_paranoid = 1\nkernel.kptr_restrict = 0","handlingStrategy":"validation","validationCode":"// host-side pre-check before starting Cassandra\nlong paranoid = Long.parseLong(Files.readAllLines(Paths.get(\"/proc/sys/kernel/perf_event_paranoid\")).get(0).trim());\nlong kptr = Long.parseLong(Files.readAllLines(Paths.get(\"/proc/sys/kernel/kptr_restrict\")).get(0).trim());\nif (paranoid > 1 || kptr != 0) System.out.println(\"Fix sysctls: perf_event_paranoid<=1, kptr_restrict=0\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provision Cassandra hosts (or container images) with perf_event_paranoid=1 and kptr_restrict=0 in sysctl.d.","Grant the Cassandra service CAP_PERFMON/CAP_SYS_ADMIN when sysctls are locked down.","Document profiler requirements in the deployment runbook."],"tags":["profiling","linux-kernel","async-profiler","startup-check","sysctl"],"backgroundTag":"unsupported-platform","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}