{"record":{"id":"6176f87b00e2020e","repo":"apache/cassandra","slug":"jemalloc-shared-library-could-not-be-preloaded-to","errorCode":null,"errorMessage":"jemalloc shared library could not be preloaded to speed up memory allocations","messagePattern":"jemalloc shared library could not be preloaded to speed up memory allocations","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/StartupChecks.java","lineNumber":320,"sourceCode":"    };\n\n    public static final StartupCheck checkJemalloc = new StartupCheck()\n    {\n        @Override\n        public String name()\n        {\n            return \"jemalloc\";\n        }\n\n        @Override\n        public void execute(StartupChecksConfiguration configuration)\n        {\n            if (configuration.isDisabled(name()))\n                return;\n\n            String jemalloc = CassandraRelevantProperties.LIBJEMALLOC.getString();\n            if (jemalloc == null)\n                logger.warn(\"jemalloc shared library could not be preloaded to speed up memory allocations\");\n            else if (\"-\".equals(jemalloc))\n                logger.info(\"jemalloc preload explicitly disabled\");\n            else\n                logger.info(\"jemalloc seems to be preloaded from {}\", jemalloc);\n        }\n    };\n\n    public static final StartupCheck checkLz4Native = new StartupCheck()\n    {\n        @Override\n        public String name()\n        {\n            return \"lz4_native\";\n        }\n\n        @Override\n        public void execute(StartupChecksConfiguration configuration)\n        {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StartupChecks.java#L302-L338","documentation":"A WARN log (not an exception) from the checkJemalloc startup check's execute(). Cassandra tries to preload libjemalloc to speed up native memory allocations; if the cassandra.libjemalloc system property is unset (jemalloc == null), jemalloc was not preloaded by the startup script and performance of off-heap allocations may suffer. If set to '-', preload was explicitly disabled (INFO), if set to a path, jemalloc is active (INFO).","triggerScenarios":"checkJemalloc.execute() runs at node startup while CassandraRelevantProperties.LIBJEMALLOC is not set, meaning the startup script (cassandra-env.sh) could not find or load a jemalloc shared library (libjemalloc.so.2/libjemalloc.so.1).","commonSituations":"Minimal container images without jemalloc installed; jemalloc in a non-standard location not found by cassandra-env.sh; operators who removed it or run on distros where the package name differs (libjemalloc2 vs libjemalloc1).","solutions":["Install jemalloc on the host (apt install libjemalloc2 / yum install jemalloc)","Set the path explicitly via JVM opt -Dcassandra.libjemalloc=/path/to/libjemalloc.so.2 in jvm-server.options if it lives outside default search paths","If preloading is intentionally unwanted, set cassandra.libjemalloc=- to record an explicit disable (removes the warning semantics)"],"exampleFix":"// before (jvm-server.options)\n# nothing\n\n// after\n-Dcassandra.libjemalloc=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2","handlingStrategy":"validation","validationCode":"// Pre-flight: verify jemalloc can be located before starting the node\nString jemalloc = System.getProperty(\"cassandra.libjemalloc\");\nString found = jemalloc != null ? jemalloc :\n    java.util.stream.Stream.of(\"/usr/lib/x86_64-linux-gnu/libjemalloc.so.2\", \"/usr/lib64/libjemalloc.so.2\")\n        .filter(p -> new java.io.File(p).exists()).findFirst().orElse(null);\nif (found == null) System.out.println(\"WARNING: libjemalloc not found; install it or set -Dcassandra.libjemalloc=<path>\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install jemalloc in every Cassandra host image (libjemalloc2 on Debian/Ubuntu)","Bake -Dcassandra.libjemalloc=<path> into jvm-server.options when the library is outside default paths","Use cassandra.libjemalloc=- to record an intentional disable rather than leaving it unconfigured","Confirm preloading by checking the INFO 'jemalloc seems to be preloaded from ...' log at startup"],"tags":["jemalloc","native-library","performance","startup-checks","environment"],"backgroundTag":"missing-optional-dependency","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"}