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

LeakSanitizer: detected memory leaks in mem_heap_create_block_func after attempt to create foreign key

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a TEXT) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
      SET FOREIGN_KEY_CHECKS=OFF;
      --error ER_TOO_BIG_ROWSIZE
      ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES x(x);
       
      --source include/restart_mysqld.inc
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 af912664

      ==27497==ERROR: LeakSanitizer: detected memory leaks
       
      Indirect leak of 592 byte(s) in 1 object(s) allocated from:
          #0 0x7fabc534a330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x561f7b79caaa in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /data/src/10.4/storage/innobase/mem/mem0mem.cc:277
          #2 0x561f7b79d381 in mem_heap_add_block(mem_block_info_t*, unsigned long) /data/src/10.4/storage/innobase/mem/mem0mem.cc:379
          #3 0x561f7bc81fc3 in mem_heap_alloc /data/src/10.4/storage/innobase/include/mem0mem.ic:191
          #4 0x561f7bc81dd4 in mem_heap_zalloc /data/src/10.4/storage/innobase/include/mem0mem.ic:160
          #5 0x561f7bc8858a in dict_mem_foreign_create() /data/src/10.4/storage/innobase/dict/dict0mem.cc:781
          #6 0x561f7b639cc8 in innobase_get_foreign_key_info /data/src/10.4/storage/innobase/handler/handler0alter.cc:2973
          #7 0x561f7b660cc5 in ha_innobase::prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /data/src/10.4/storage/innobase/handler/handler0alter.cc:7973
          #8 0x561f7b02dff7 in handler::ha_prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /data/src/10.4/sql/handler.cc:4554
          #9 0x561f7aa8ad1c in mysql_inplace_alter_table /data/src/10.4/sql/sql_table.cc:7687
          #10 0x561f7aa9c079 in mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /data/src/10.4/sql/sql_table.cc:10127
          #11 0x561f7ac15296 in Sql_cmd_alter_table::execute(THD*) /data/src/10.4/sql/sql_alter.cc:502
          #12 0x561f7a8474ce in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:6101
          #13 0x561f7a853481 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7900
          #14 0x561f7a8282f4 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1841
          #15 0x561f7a824a9d in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1359
          #16 0x561f7abfd0ef in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
          #17 0x561f7abfc991 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
          #18 0x561f7c23a47c in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
          #19 0x7fabc5247fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
       
      Indirect leak of 232 byte(s) in 1 object(s) allocated from:
          #0 0x7fabc534a330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x561f7b79caaa in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /data/src/10.4/storage/innobase/mem/mem0mem.cc:277
          #2 0x561f7bc82084 in mem_heap_create_func /data/src/10.4/storage/innobase/include/mem0mem.ic:375
          #3 0x561f7bc8856f in dict_mem_foreign_create() /data/src/10.4/storage/innobase/dict/dict0mem.cc:778
          #4 0x561f7b639cc8 in innobase_get_foreign_key_info /data/src/10.4/storage/innobase/handler/handler0alter.cc:2973
          #5 0x561f7b660cc5 in ha_innobase::prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /data/src/10.4/storage/innobase/handler/handler0alter.cc:7973
          #6 0x561f7b02dff7 in handler::ha_prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /data/src/10.4/sql/handler.cc:4554
          #7 0x561f7aa8ad1c in mysql_inplace_alter_table /data/src/10.4/sql/sql_table.cc:7687
          #8 0x561f7aa9c079 in mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /data/src/10.4/sql/sql_table.cc:10127
          #9 0x561f7ac15296 in Sql_cmd_alter_table::execute(THD*) /data/src/10.4/sql/sql_alter.cc:502
          #10 0x561f7a8474ce in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:6101
          #11 0x561f7a853481 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7900
          #12 0x561f7a8282f4 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1841
          #13 0x561f7a824a9d in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1359
          #14 0x561f7abfd0ef in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
          #15 0x561f7abfc991 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
          #16 0x561f7c23a47c in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
          #17 0x7fabc5247fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
       
      SUMMARY: AddressSanitizer: 824 byte(s) leaked in 2 allocation(s).
      

      Reproducible on 10.4, 10.5.
      The test case is not applicable to 10.3, ALTER fails with ER_BLOB_KEY_WITHOUT_LENGTH instead. If I add the error to the suppression list, there is no leak detected upon shutdown.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.