Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-39513

connect table_type=INI memory leak

    XMLWordPrintable

Details

    • Can result in data loss

    Description

      INSTALL SONAME 'ha_connect.so';
      CREATE TABLE t (c INT) ENGINE=CONNECT table_type=INI file_name='/tmp/foobar';
      UPDATE t SET c=0;
      SHUTDOWN;
      

      Leads to:

      CS 13.0.1 3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23 (Debug, UBASAN, Clang 21.1.3-20250923) Build 10/04/2026

      ==3055665==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 12 byte(s) in 1 object(s) allocated from:
          #0 0x5b1e20658e48 in malloc (/test/UBASAN_MD100426-mariadb-13.0.1-linux-x86_64-dbg/bin/mariadbd+0x4139e48) (BuildId: 57d40479ece88ee21294f041e3ea8c6902999338)
          #1 0x688cb4f72849  (<unknown module>)
          #2 0x688cb4f71887  (<unknown module>)
          #3 0x688cb4f716dc  (<unknown module>)
          #4 0x688cb4ecffc0  (<unknown module>)
          #5 0x688cb4d28f24  (<unknown module>)
          #6 0x688cb4cf4eae  (<unknown module>)
          #7 0x5b1e21d64b4c in Sql_cmd_update::update_single_table(THD*) /test/13.0_dbg_san/sql/sql_update.cc:512:16
          #8 0x5b1e21d918bc in Sql_cmd_update::execute_inner(THD*) /test/13.0_dbg_san/sql/sql_update.cc:3237:10
          #9 0x5b1e21a92110 in Sql_cmd_dml::execute(THD*) /test/13.0_dbg_san/sql/sql_select.cc:34993:9
          #10 0x5b1e2177b45e in mysql_execute_command(THD*, bool) /test/13.0_dbg_san/sql/sql_parse.cc:4444:27
          #11 0x5b1e2175e21d in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/13.0_dbg_san/sql/sql_parse.cc:7941:18
          #12 0x5b1e21755fee in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/13.0_dbg_san/sql/sql_parse.cc:1898:7
          #13 0x5b1e217605c4 in do_command(THD*, bool) /test/13.0_dbg_san/sql/sql_parse.cc:1432:17
          #14 0x5b1e21f9884c in do_handle_one_connection(CONNECT*, bool) /test/13.0_dbg_san/sql/sql_connect.cc:1503:11
          #15 0x5b1e21f98355 in handle_one_connection /test/13.0_dbg_san/sql/sql_connect.cc:1415:5
          #16 0x5b1e206566ca in asan_thread_start(void*) crtstuff.c
       
      SUMMARY: AddressSanitizer: 12 byte(s) leaked in 1 allocation(s).
      

      Setup:

      Compiled with a recent version of Clang and LLVM. Ubuntu instructions for Clang/LLVM 18:
        # Note: It is strongly recommended to uninstall all old Clang & LLVM packages (ref  dpkg --list | grep -iE 'clang|llvm'  and use  apt purge  and  dpkg --purge  to remove the packages), before installing Clang/LLVM 18
           sudo apt install clang llvm-18 llvm-18-linker-tools llvm-18-runtime llvm-18-tools llvm-18-dev libstdc++-14-dev llvm-dev lld-18
      Compiled with: "-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C{,XX}_FLAGS='-march=native -mtune=native'" and:
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1   # And you may also want to supress UBSAN startup issues using 'suppressions=UBSAN.filter' in UBSAN_OPTIONS. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter
          export ASAN_OPTIONS=quarantine_size_mb=512:atexit=0:detect_invalid_pointer_pairs=3:dump_instruction_bytes=1:abort_on_error=1:allocator_may_return_null=1
      

      SAN Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  No bug found                  
      CS  10.6   opt  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  No bug found                  
      CS  10.11  dbg  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  No bug found                  
      CS  10.11  opt  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  No bug found                  
      CS  11.4   dbg  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  11.4   opt  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  11.8   dbg  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  11.8   opt  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  12.3   dbg  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  12.3   opt  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  13.0   dbg  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      CS  13.0   opt  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  10.6   dbg  100426  84a80c8b38208d362225496da08d86d8d454e453  No bug found                  
      ES  10.6   opt  100426  84a80c8b38208d362225496da08d86d8d454e453  No bug found                  
      ES  11.4   dbg  100426  8b2bf17b733262409422ce7d039a0c021fc47077  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  11.4   opt  100426  8b2bf17b733262409422ce7d039a0c021fc47077  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  11.8   dbg  100426  854cae81f52e477c7777a51db26ba640d8755b81  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  11.8   opt  100426  854cae81f52e477c7777a51db26ba640d8755b81  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  12.3   dbg  220426  613a6253fe9efc12e166f83a97663ba263db8317  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      ES  12.3   opt  220426  613a6253fe9efc12e166f83a97663ba263db8317  LSAN|memory leak|<unknown_module>|malloc|Sql_cmd_update::update_single_table|Sql_cmd_update::execute_inner|Sql_cmd_dml::execute
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.