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

Memory leak after a failed CREATE TABLE..SELECT

Details

    Description

      The following test invocation will report memory leaks in a cmake -DWITH_ASAN=ON build:

      ./mtr --rr --no-reorder innodb.lock_insert_into_empty innodb.lock_isolation
      

      10.11 0545695de7ec7bfd408f761b802400789c4881f9

      2025-04-07  1:54:58 0 [Note] InnoDB: Shutdown completed; log sequence number 127156; transaction id 148
      2025-04-07  1:54:58 0 [Note] Debug sync points hit:                   9323
      2025-04-07  1:54:58 0 [Note] Debug sync points executed:              0
      2025-04-07  1:54:58 0 [Note] Debug sync points max active per thread: 0
      2025-04-07  1:54:58 0 [Note] /dev/shm/11/sql/mariadbd: Shutdown complete
       
      =================================================================
      ==3955888==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 88 byte(s) in 1 object(s) allocated from:
          #0 0x7c075fefc698 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
          #1 0x60a2f73497c8 in trx_mod_table_time_t::start_bulk_insert(dict_table_t*, bool) /home/marko/10.11/storage/innobase/include/trx0trx.h:460
          #2 0x60a2f73497c8 in row_ins_clust_index_entry_low(unsigned long, btr_latch_mode, dict_index_t*, unsigned long, dtuple_t*, unsigned long, que_thr_t*) /home/marko/10.11/storage/innobase/row/row0ins.cc:2847
          #3 0x60a2f734a516 in row_ins_clust_index_entry(dict_index_t*, dtuple_t*, que_thr_t*, unsigned long) /home/marko/10.11/storage/innobase/row/row0ins.cc:3338
          #4 0x60a2f734e3fb in row_ins_index_entry /home/marko/10.11/storage/innobase/row/row0ins.cc:3483
          #5 0x60a2f734e3fb in row_ins_index_entry_step /home/marko/10.11/storage/innobase/row/row0ins.cc:3649
          #6 0x60a2f734e3fb in row_ins /home/marko/10.11/storage/innobase/row/row0ins.cc:3774
          #7 0x60a2f734e3fb in row_ins_step(que_thr_t*) /home/marko/10.11/storage/innobase/row/row0ins.cc:3903
          #8 0x60a2f73aef3a in row_insert_for_mysql(unsigned char const*, row_prebuilt_t*, ins_mode_t) /home/marko/10.11/storage/innobase/row/row0mysql.cc:1296
          #9 0x60a2f6f466fb in ha_innobase::write_row(unsigned char const*) /home/marko/10.11/storage/innobase/handler/ha_innodb.cc:7822
       
      Indirect leak of 798912 byte(s) in 1 object(s) allocated from:
          #0 0x7c075fefbb37 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x60a2f735f70b in row_merge_buf_create_low /home/marko/10.11/storage/innobase/row/row0merge.cc:335
       
      Indirect leak of 592 byte(s) in 1 object(s) allocated from:
          #0 0x7c075fefbb37 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x60a2f72229df in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /home/marko/10.11/storage/innobase/mem/mem0mem.cc:278
          #2 0x60a2f7222d91 in mem_heap_add_block(mem_block_info_t*, unsigned long) /home/marko/10.11/storage/innobase/mem/mem0mem.cc:379
       
      Indirect leak of 232 byte(s) in 1 object(s) allocated from:
          #0 0x7c075fefbb37 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x60a2f72229df in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /home/marko/10.11/storage/innobase/mem/mem0mem.cc:278
          #2 0x60a2f73653e2 in mem_heap_create_func /home/marko/10.11/storage/innobase/include/mem0mem.inl:377
          #3 0x60a2f73653e2 in row_merge_bulk_t::row_merge_bulk_t(dict_table_t*, bool) /home/marko/10.11/storage/innobase/row/row0merge.cc:5079
       
      Indirect leak of 56 byte(s) in 1 object(s) allocated from:
          #0 0x7c075fefb4d0 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
          #1 0x60a2f736534c in row_merge_bulk_t::row_merge_bulk_t(dict_table_t*, bool) /home/marko/10.11/storage/innobase/row/row0merge.cc:5070
       
      SUMMARY: AddressSanitizer: 799880 byte(s) leaked in 5 allocation(s).
      

      I narrowed this down based on a nondeterministic test failure that I had observed on https://buildbot.mariadb.org.

      Attachments

        Issue Links

          Activity

            Can you please show the minimal test case for reproducing this? Is the scenario limited to rolling back a CREATE TABLE…SELECT statement? Is a memory leak possible also when using innodb_alter_copy_bulk=ON (MDEV-33087)?

            marko Marko Mäkelä added a comment - Can you please show the minimal test case for reproducing this? Is the scenario limited to rolling back a CREATE TABLE…SELECT statement? Is a memory leak possible also when using innodb_alter_copy_bulk=ON ( MDEV-33087 )?
            marko Marko Mäkelä added a comment -

            MDEV-36609, which shares a fix with this one, is about a crash during CREATE TABLE…SELECT where the SELECT part is a join of multiple tables.

            marko Marko Mäkelä added a comment - MDEV-36609 , which shares a fix with this one, is about a crash during CREATE TABLE…SELECT where the SELECT part is a join of multiple tables.

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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