Details
-
Bug
-
Status: Done
-
Low
-
Resolution: Fixed
-
3.0.11, 3.0.12
-
None
-
Yes
-
2
Description
Output from pt-mysql-summary will determine if jemalloc is enabled:
[[email protected] sbin]# /usr/bin/pt-mysql-summary Memory management library ################################## jemalloc enabled in mysql config for process with id 3403 Using jemalloc from /usr/lib64/libjemalloc.so.1 The End ####################################################
But it checks it using find which isn't guaranteed to be correct if two versions of jemalloc are installed:
JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1)
So for instance in this case it gives incorrect results:
[[email protected] lib64]# touch libjemalloc.empty [[email protected] lib64]# rm libjemalloc.so.1 rm: remove regular file ‘libjemalloc.so.1’? y [[email protected] lib64]# /usr/bin/pt-mysql-summary Memory management library ################################## jemalloc enabled in mysql config for process with id 3403 Using jemalloc from /usr/lib64/libjemalloc.empty The End ####################################################
The tool checks if jemalloc is in use from checking environ and ldd:
for pid in $(pidof mysqld); do grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null| grep -qc jemalloc jemalloc_status=$?
It would be much better to check this output again to find the correct version loaded, for example:
# strings /proc/$(pidof mysqld)/environ | grep jemalloc LD_PRELOAD=/usr/lib64/libjemalloc.so.1