Environment -AWS EC2(t3.xlarge) -Rocky-8-EC2-Base-8.8-20230518.0.x86_64-d6577ceb-8ea8-4e0e-84c6-f098fc302e82 =============== Install Section =============== 1) Install Develop Package # dnf update # dnf group install "Development Tools" # dnf install ncurses-devel cmake libxml2-devel boost libaio-devel systemd-devel libasan 2) Get source code from git # git clone -b 10.11 https://github.com/MariaDB/server.git 3) Apply Patch # cd server # vi patch_file.diff ---- diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 3576730723e..835b5f4d6ac 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -514,8 +514,6 @@ static void free_plugin_mem(struct st_plugin_dl *p) restore_ptr_backup(p->nbackups, p->ptr_backup); my_free(p->ptr_backup); } - if (p->handle) - dlclose(p->handle); #endif my_free(const_cast(p->dl.str)); if (p->allocated) ---- # patch -p1 < patch_file.diff 4) Build # export CFLAGS="-fsanitize=address" # export CXXFLAGS="-fsanitize=address" # cmake -DWITH_SAFEMALLOC=OFF -DWITH_ASAN=ON ./ # make install -j 4 5) Product confirmation(ASAN library check) # ls -l /usr/local/mysql/ # ldd /usr/local/mysql/bin/mariadbd | grep asan libasan.so.5 => /lib64/libasan.so.5 (0x00007f4499138000) 6) Init DB # groupadd mysql # useradd -g mysql mysql # /usr/local/mysql/scripts/mariadb-install-db --datadir=/var/lib/mysql --user=mysql 7) Create Systemd File # cp /usr/local/mysql/support-files/systemd/mariadb.service /usr/lib/systemd/system/ change ReadWritePaths=-/var/lib/mysql/data 8) Create Conf # vi /etc/my.cnf [mysqld] plugin_maturity=beta loose_handlersocket_port = 9998 loose_handlersocket_port_wr = 9999 loose_handlersocket_threads = 16 loose_handlersocket_threads_wr = 1 open_files_limit = 32768 socket=/var/lib/mysql/mysql.sock datadir = /var/lib/mysql 9) install client tool # dnf install mariadb telnet 10) Start Service # export ASAN_OPTIONS=fast_unwind_on_malloc=0 # systemctl start mariadb =============== Handler Socket Test Section =============== ------------------------------------- # mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.11.6-MariaDB Source distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> install plugin handlersocket soname 'handlersocket.so'; Query OK, 0 rows affected (0.019 sec) MariaDB [(none)]> CREATE DATABASE testdb; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> CREATE TABLE testdb.table1 (k int key, v char(20)); Query OK, 0 rows affected (0.009 sec) MariaDB [(none)]> INSERT INTO testdb.table1 values (234,'foo'),(678,'bar'); Query OK, 2 rows affected (0.002 sec) Records: 2 Duplicates: 0 Warnings: 0 MariaDB [(none)]> quit Bye ------------------------------------- # telnet localhost 9999 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. P 0 testdb table1 PRIMARY k,v 0 1 0 = 1 234 0 2 234 foo 0 + 2 789 hoge 0 1 0 = 1 789 0 2 789 hoge ^] telnet> quit Connection closed. ------------------------------------- # systemctl stop mariadb "Oct 24 02:20:02" in mariadb_mleak_log * Stop after handler socket operation # systemctl start mariadb # systemctl stop mariadb "Oct 24 02:21:23" in mariadb_mleak_log * Stop after non operation. only start and stop