Bug 248982 - databases/mysql57-server and malloc-lib path
Summary: databases/mysql57-server and malloc-lib path
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Jochen Neumeister
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-29 01:48 UTC by Christos Chatzaras
Modified: 2020-09-14 06:56 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (joneum)


Attachments
Patch for mysqld_safe (791 bytes, application/x-sh)
2020-08-29 01:48 UTC, Christos Chatzaras
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christos Chatzaras 2020-08-29 01:48:53 UTC
Created attachment 217606 [details]
Patch for mysqld_safe

MySQL 5.7 mysqld_safe allows malloc-lib files only in certain locations.

google-perftools port puts libtcmalloc_minimal.so inside /usr/local/lib

To use tcmalloc memory allocator we need mysqld_safe to load libraries from /usr/local/lib


More information about why to use tcmalloc instead of jemalloc here:

https://forums.freebsd.org/threads/freebsd-12-x-and-mysql-5-7-and-importing-file-with-lots-of-small-lines-exhaust-ram-and-swap.72733/
Comment 1 Jochen Neumeister freebsd_committer freebsd_triage 2020-09-02 16:59:34 UTC
Hi,

thx for the PR :-)
can you please upload a diff file, not a *.sh script?
Comment 2 Christos Chatzaras 2020-09-02 18:39:10 UTC
It's a diff file for the mysqld_safe.sh script:

--- scripts/mysqld_safe.sh.orig	2020-06-02 11:05:42 UTC
+++ scripts/mysqld_safe.sh
@@ -359,7 +359,7 @@ mysqld_ld_preload_text() {
 # running mysqld.  See ld.so for details.
 set_malloc_lib() {
   # This list is kept intentionally simple.
-  malloc_dirs="/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu"
+  malloc_dirs="/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu /usr/local/lib"
   malloc_lib="$1"
 
   # Allow --malloc-lib='' to override other settings
@@ -378,6 +378,7 @@ set_malloc_lib() {
         /usr/lib64) ;;
         /usr/lib/i386-linux-gnu) ;;
         /usr/lib/x86_64-linux-gnu) ;;
+        /usr/local/lib) ;;
         *)
           log_error "--malloc-lib must be located in one of the directories: $malloc_dirs"
           exit 1
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-09-14 06:55:19 UTC
A commit references this bug:

Author: joneum
Date: Mon Sep 14 06:55:04 UTC 2020
New revision: 548590
URL: https://svnweb.freebsd.org/changeset/ports/548590

Log:
  MySQL 5.7 mysqld_safe allows malloc-lib files only in certain locations.
  google-perftools port puts libtcmalloc_minimal.so inside /usr/local/lib
  To use tcmalloc memory allocator we need mysqld_safe to load libraries from /usr/local/lib

  More information about why to use tcmalloc instead of jemalloc here:

  https://forums.freebsd.org/threads/freebsd-12-x-and-mysql-5-7-and-importing-file-with-lots-of-small-lines-exhaust-ram-and-swap.72733/

  PR:		248982
  Sponsored by:	Netzkommune GmbH

Changes:
  head/databases/mysql57-server/files/patch-scripts_mysqld__safe.txt