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

Memory leak in innodb.import_hidden_fts_debug

    XMLWordPrintable

Details

    • Related to performance

    Description

      I found the following failure in a 11.4 based development branch, which curiously is not found by https://buildbot.mariadb.org/cr/ when I search for the test name:

      MDEV-37949 efff84b7c04ae2128d3df62dde65b5bc304690c3

      innodb.innodb-autoinc-44030              w2 [ fail ]  Found warnings/errors in server log file!
              Test ended at 2025-12-18 15:41:11
      line
      ==394313==ERROR: LeakSanitizer: detected memory leaks
      SUMMARY: AddressSanitizer: 2096 byte(s) leaked in 2 allocation(s).
      251218 15:31:08 [ERROR] /home/buildbot/bld/sql/mariadbd got signal 6 ;
      Attempting backtrace. Include this in the bug report.
      

      In the server error log, I see the following. I believe that this should also be possible on the current head of the 11.4 branch, which this branch is based on:

      MDEV-37949 efff84b7c04ae2128d3df62dde65b5bc304690c3

      CURRENT_TEST: funcs_1.innodb_views
      $ /home/buildbot/bld/sql/mariadbd …
      CURRENT_TEST: gcol.innodb_virtual_rebuild
      CURRENT_TEST: gcol.innodb_virtual_stats
      CURRENT_TEST: gcol.virtual_index_drop
      CURRENT_TEST: innodb.add_foreign_key
      CURRENT_TEST: innodb.alter_candidate_key
      CURRENT_TEST: innodb.alter_key_block_size-11757
      CURRENT_TEST: innodb.alter_table_upgrade
      CURRENT_TEST: innodb.alter_varchar_change
      CURRENT_TEST: innodb.cascade_lock_wait
      CURRENT_TEST: innodb.create-index
      CURRENT_TEST: innodb.cursor-restore-locking
      CURRENT_TEST: innodb.evict_tables_on_commit_debug
      CURRENT_TEST: innodb.foreign_key_debug
      CURRENT_TEST: innodb.gap_locks
      CURRENT_TEST: innodb.import_cfg
      CURRENT_TEST: innodb.import_hidden_fts_debug
      CURRENT_TEST: innodb.innodb-agregate
      CURRENT_TEST: innodb.innodb-autoinc-44030
       
      2025-12-18 15:31:08 0 [Note] /home/buildbot/bld/sql/mariadbd: Shutdown complete
       
      =================================================================
      ==394313==ERROR: LeakSanitizer: detected memory leaks
       
      Indirect leak of 1432 byte(s) in 1 object(s) allocated from:
          #0 0x55e87f546944 in malloc (/home/buildbot/bld/sql/mariadbd+0x4029944) (BuildId: eb6ec8f1f0b327ce8008be69360b0dbd9a9f87e6)
          #1 0x55e882999f40 in ut_allocator<unsigned char, true>::allocate(unsigned long, unsigned char const*, unsigned int, bool, bool) /home/buildbot/src/storage/innobase/include/ut0new.h:374:11
          #2 0x55e882d0b0cd in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /home/buildbot/src/storage/innobase/mem/mem0mem.cc:278:37
          #3 0x55e882d0c679 in mem_heap_add_block(mem_block_info_t*, unsigned long) /home/buildbot/src/storage/innobase/mem/mem0mem.cc:379:14
          #4 0x55e882e324ab in mem_heap_alloc(mem_block_info_t*, unsigned long) /home/buildbot/src/storage/innobase/include/mem0mem.inl:193:11
          #5 0x55e882e45ad9 in ib_heap_malloc(ib_alloc_t*, unsigned long) /home/buildbot/src/storage/innobase/include/ut0vec.inl:39:9
          #6 0x55e8832eb99d in ib_vector_create(ib_alloc_t*, unsigned long, unsigned long) /home/buildbot/src/storage/innobase/ut/ut0vec.cc:52:3
          #7 0x55e882e3f6d7 in pars_info_add_literal(pars_info_t*, char const*, void const*, unsigned long, unsigned long, unsigned long) /home/buildbot/src/storage/innobase/pars/pars0pars.cc:2085:22
          #8 0x55e882e410d7 in pars_info_add_ull_literal(pars_info_t*, char const*, unsigned long) /home/buildbot/src/storage/innobase/pars/pars0pars.cc:2253:2
          #9 0x55e882eeaeb8 in update_vcol_pos(unsigned long, unsigned long, trx_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:4661:3
          #10 0x55e882efe4e3 in innodb_insert_hidden_fts_col(dict_table_t*, unsigned long, trx_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:4697:22
          #11 0x55e882eef64e in row_import_for_mysql(dict_table_t*, row_prebuilt_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:5048:9
          #12 0x55e882927eb5 in ha_innobase::discard_or_import_tablespace(char) /home/buildbot/src/storage/innobase/handler/ha_innodb.cc:13403:9
          #13 0x55e8813e3f16 in handler::ha_discard_or_import_tablespace(char) /home/buildbot/src/sql/handler.cc:5598:10
          #14 0x55e8803e0708 in mysql_discard_or_import_tablespace(THD*, TABLE_LIST*, bool) /home/buildbot/src/sql/sql_table.cc:6033:23
          #15 0x55e88081cd0e in Sql_cmd_discard_import_tablespace::execute(THD*) /home/buildbot/src/sql/sql_alter.cc:739:5
          #16 0x55e87fe0a4cc in mysql_execute_command(THD*, bool) /home/buildbot/src/sql/sql_parse.cc:5915:26
          #17 0x55e87fdb2975 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /home/buildbot/src/sql/sql_parse.cc:7944:18
          #18 0x55e87fda07f8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /home/buildbot/src/sql/sql_parse.cc:1920:7
          #19 0x55e87fdb884c in do_command(THD*, bool) /home/buildbot/src/sql/sql_parse.cc:1433:17
          #20 0x55e8807dfb13 in do_handle_one_connection(CONNECT*, bool) /home/buildbot/src/sql/sql_connect.cc:1497:11
          #21 0x55e8807dee27 in handle_one_connection /home/buildbot/src/sql/sql_connect.cc:1409:5
          #22 0x55e8824aee81 in pfs_spawn_thread /home/buildbot/src/storage/perfschema/pfs.cc:2201:3
          #23 0x55e87f5442c6 in asan_thread_start(void*) asan_interceptors.cpp.o
       
      Indirect leak of 664 byte(s) in 1 object(s) allocated from:
          #0 0x55e87f546944 in malloc (/home/buildbot/bld/sql/mariadbd+0x4029944) (BuildId: eb6ec8f1f0b327ce8008be69360b0dbd9a9f87e6)
          #1 0x55e882999f40 in ut_allocator<unsigned char, true>::allocate(unsigned long, unsigned char const*, unsigned int, bool, bool) /home/buildbot/src/storage/innobase/include/ut0new.h:374:11
          #2 0x55e882d0b0cd in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /home/buildbot/src/storage/innobase/mem/mem0mem.cc:278:37
          #3 0x55e882e3e7e8 in mem_heap_create_func(unsigned long, char const*, unsigned int, unsigned long) /home/buildbot/src/storage/innobase/include/mem0mem.inl:377:10
          #4 0x55e882e3ef99 in pars_info_create() /home/buildbot/src/storage/innobase/pars/pars0pars.cc:2044:9
          #5 0x55e882eeaea0 in update_vcol_pos(unsigned long, unsigned long, trx_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:4660:22
          #6 0x55e882efe4e3 in innodb_insert_hidden_fts_col(dict_table_t*, unsigned long, trx_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:4697:22
          #7 0x55e882eef64e in row_import_for_mysql(dict_table_t*, row_prebuilt_t*) /home/buildbot/src/storage/innobase/row/row0import.cc:5048:9
          #8 0x55e882927eb5 in ha_innobase::discard_or_import_tablespace(char) /home/buildbot/src/storage/innobase/handler/ha_innodb.cc:13403:9
          #9 0x55e8813e3f16 in handler::ha_discard_or_import_tablespace(char) /home/buildbot/src/sql/handler.cc:5598:10
          #10 0x55e8803e0708 in mysql_discard_or_import_tablespace(THD*, TABLE_LIST*, bool) /home/buildbot/src/sql/sql_table.cc:6033:23
          #11 0x55e88081cd0e in Sql_cmd_discard_import_tablespace::execute(THD*) /home/buildbot/src/sql/sql_alter.cc:739:5
          #12 0x55e87fe0a4cc in mysql_execute_command(THD*, bool) /home/buildbot/src/sql/sql_parse.cc:5915:26
          #13 0x55e87fdb2975 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /home/buildbot/src/sql/sql_parse.cc:7944:18
          #14 0x55e87fda07f8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /home/buildbot/src/sql/sql_parse.cc:1920:7
          #15 0x55e87fdb884c in do_command(THD*, bool) /home/buildbot/src/sql/sql_parse.cc:1433:17
          #16 0x55e8807dfb13 in do_handle_one_connection(CONNECT*, bool) /home/buildbot/src/sql/sql_connect.cc:1497:11
          #17 0x55e8807dee27 in handle_one_connection /home/buildbot/src/sql/sql_connect.cc:1409:5
          #18 0x55e8824aee81 in pfs_spawn_thread /home/buildbot/src/storage/perfschema/pfs.cc:2201:3
          #19 0x55e87f5442c6 in asan_thread_start(void*) asan_interceptors.cpp.o
       
      SUMMARY: AddressSanitizer: 2096 byte(s) leaked in 2 allocation(s).
      251218 15:31:08 [ERROR] /home/buildbot/bld/sql/mariadbd got signal 6 ;
      

      Based on the error log output, I tried to reproduce this as follows, successfully:

      mysql-test/mtr --no-reorder funcs_1.innodb_views gcol.innodb_virtual_rebuild gcol.innodb_virtual_stats gcol.virtual_index_drop innodb.add_foreign_key innodb.alter_candidate_key innodb.alter_key_block_size-11757 innodb.alter_table_upgrade innodb.alter_varchar_change innodb.cascade_lock_wait innodb.create-index innodb.cursor-restore-locking innodb.evict_tables_on_commit_debug innodb.foreign_key_debug innodb.gap_locks innodb.import_cfg innodb.import_hidden_fts_debug innodb.innodb-agregate innodb.innodb-autoinc-44030
      

      The next attempt produced the same two leaks as well:

      mysql-test/mtr --skip-stack-trace --no-reorder innodb.evict_tables_on_commit_debug innodb.foreign_key_debug innodb.gap_locks innodb.import_cfg innodb.import_hidden_fts_debug innodb.innodb-agregate
      

      11.4 4cff562f3f89d4df03e09233d835d0451bc37cc4

      innodb.evict_tables_on_commit_debug      [ pass ]      9
      innodb.foreign_key_debug                 [ pass ]    148
      innodb.gap_locks                         [ pass ]     15
      innodb.import_cfg                        [ pass ]     51
      innodb.import_hidden_fts_debug           [ pass ]   1163
      innodb.innodb-agregate                   [ pass ]     11
      ***Warnings generated in error logs during shutdown after running tests: innodb.innodb-agregate innodb.import_hidden_fts_debug innodb.import_cfg innodb.gap_locks innodb.foreign_key_debug innodb.evict_tables_on_commit_debug
       
      ==30218==ERROR: LeakSanitizer: detected memory leaks
      SUMMARY: AddressSanitizer: 2048 byte(s) leaked in 2 allocation(s).
      251219  9:17:43 [ERROR] /dev/shm/s/sql/mariadbd got signal 6 ;
      

      In the end, it turns out to be sufficient to run just one test:

      mysql-test/mtr --skip-stack-trace innodb.import_hidden_fts_debug
      

      11.4 4cff562f3f89d4df03e09233d835d0451bc37cc4

      innodb.import_hidden_fts_debug           [ pass ]    177
      ***Warnings generated in error logs during shutdown after running tests: innodb.import_hidden_fts_debug
       
      ==31648==ERROR: LeakSanitizer: detected memory leaks
      SUMMARY: AddressSanitizer: 2048 byte(s) leaked in 2 allocation(s).
      

      This test case had been introduced in MDEV-30655. I didn’t check whether the memory leaks were introduced at the same time.

      I find alarming that https://buildbot.mariadb.org/cr/ does not seem to find these failures. I think that a clang based -fsanitize=address -fsanitize=undefined builder needs to be part of the branch protection.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.