Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Duplicate
-
None
-
None
-
Code
-
Normal
-
Normal
-
Adhoc Test
-
All
-
None
-
Description
I noticed that there was this log message when I started a Cassandra node on a machine in AWS on Ubuntu Jelly (22.04).
WARN [main] 2022-07-27 11:04:16,731 StartupChecks.java:200 - jemalloc shared library could not be preloaded to speed up memory allocations
Hence, I went ahead and I tried to install that package, on 22.04,
$ apt search libjemalloc
Sorting... Done
Full Text Search... Done
libjemalloc-dev/jammy 5.2.1-4ubuntu1 amd64
development files and documentation for jemalloc
libjemalloc2/jammy,now 5.2.1-4ubuntu1 amd64
general-purpose scalable concurrent malloc(3) implementation
So I did apt install libjemalloc2.
But the problems didnt go away because cassandra script didnt recognised it. The value of JVM property the jemalloc startup check is reading from is an environment property called CASSANDRA_LIBJEMALLOC (1) which is set by us looking into various library paths, trying to find "libjemalloc.so.1"(2). But there is no "1" version of it. We have version "2".
$ sudo dpkg -L libjemalloc2 /. /usr /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 <---- our tasty libjemalloc /usr/share /usr/share/doc /usr/share/doc/libjemalloc2 /usr/share/doc/libjemalloc2/README /usr/share/doc/libjemalloc2/changelog.Debian.gz /usr/share/doc/libjemalloc2/copyright
(1) https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L160
(2) https://github.com/apache/cassandra/blob/cassandra-4.0/bin/cassandra#L157
I checked what Debian is offering and Bullseye and Buster do not have libjemalloc1 anymore, they have version 2, 1 is gone. Strech and Jessie have version 1 and not 2 (obviously). Ubuntu Jelly has 2, I am not sure when they started to ship 2 instead of 1 but I assume that if a user runs Cassandra on "anything recent", this is broken, jemalloc is not used and I think that performance can suffer quite significantly.
This logic is present from 3.0 onwards.
The patch should fix this and it should take both versions into account. I will provide patch with my solution shortly.
Attachments
Issue Links
- duplicates
-
CASSANDRA-15767 /usr/bin/cassandra looking for wrong libjemalloc.so file
- Resolved