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

LeakSanitizer: detected memory leaks in mem_heap_create_block_func

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
      --error ER_CANT_CREATE_TABLE
      ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
       
      # Cleanup
      DROP TABLE t1;
      

      10.5 35c27785

      ==21075==ERROR: LeakSanitizer: detected memory leaks
       
      Indirect leak of 616 byte(s) in 1 object(s) allocated from:
          #0 0x7f9e675e7d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x55d6dc147c09 in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /data/src/10.5/storage/innobase/mem/mem0mem.cc:280
          #2 0x55d6dc14836e in mem_heap_add_block(mem_block_info_t*, unsigned long) /data/src/10.5/storage/innobase/mem/mem0mem.cc:386
          #3 0x55d6dc598372 in mem_heap_alloc /data/src/10.5/storage/innobase/include/mem0mem.ic:203
          #4 0x55d6dc598177 in mem_heap_zalloc /data/src/10.5/storage/innobase/include/mem0mem.ic:170
          #5 0x55d6dc59e37c in dict_mem_foreign_create() /data/src/10.5/storage/innobase/dict/dict0mem.cc:778
          #6 0x55d6dbfa0a87 in create_table_info_t::create_foreign_keys() /data/src/10.5/storage/innobase/handler/ha_innodb.cc:12321
          #7 0x55d6dbfa393e in create_table_info_t::create_table(bool) /data/src/10.5/storage/innobase/handler/ha_innodb.cc:12765
          #8 0x55d6dbfd341c in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*, bool, trx_t*) (/data/bld/10.5-asan-nightly/bin/mysqld+0x248141c)
          #9 0x55d6dbfa5457 in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5/storage/innobase/handler/ha_innodb.cc:13263
          #10 0x55d6db621a53 in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5/sql/handler.cc:4718
          #11 0x55d6db625b7d in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /data/src/10.5/sql/handler.cc:5182
          #12 0x55d6db11cb4c 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.5/sql/sql_table.cc:10189
          #13 0x55d6db2883cb in Sql_cmd_alter_table::execute(THD*) /data/src/10.5/sql/sql_alter.cc:523
          #14 0x55d6daede4a7 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:5959
          #15 0x55d6daeea27e in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5/sql/sql_parse.cc:7997
          #16 0x55d6daec306d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1846
          #17 0x55d6daebfffd in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1364
          #18 0x55d6db271d38 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1422
          #19 0x55d6db27172e in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1319
          #20 0x55d6dbea8a65 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:1869
          #21 0x7f9e673104a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Indirect leak of 240 byte(s) in 1 object(s) allocated from:
          #0 0x7f9e675e7d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x55d6dc147c09 in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned int, unsigned long) /data/src/10.5/storage/innobase/mem/mem0mem.cc:280
          #2 0x55d6dc598433 in mem_heap_create_func /data/src/10.5/storage/innobase/include/mem0mem.ic:393
          #3 0x55d6dc59e361 in dict_mem_foreign_create() /data/src/10.5/storage/innobase/dict/dict0mem.cc:775
          #4 0x55d6dbfa0a87 in create_table_info_t::create_foreign_keys() /data/src/10.5/storage/innobase/handler/ha_innodb.cc:12321
          #5 0x55d6dbfa393e in create_table_info_t::create_table(bool) /data/src/10.5/storage/innobase/handler/ha_innodb.cc:12765
          #6 0x55d6dbfd341c in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*, bool, trx_t*) (/data/bld/10.5-asan-nightly/bin/mysqld+0x248141c)
          #7 0x55d6dbfa5457 in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5/storage/innobase/handler/ha_innodb.cc:13263
          #8 0x55d6db621a53 in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5/sql/handler.cc:4718
          #9 0x55d6db625b7d in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /data/src/10.5/sql/handler.cc:5182
          #10 0x55d6db11cb4c 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.5/sql/sql_table.cc:10189
          #11 0x55d6db2883cb in Sql_cmd_alter_table::execute(THD*) /data/src/10.5/sql/sql_alter.cc:523
          #12 0x55d6daede4a7 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:5959
          #13 0x55d6daeea27e in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5/sql/sql_parse.cc:7997
          #14 0x55d6daec306d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1846
          #15 0x55d6daebfffd in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1364
          #16 0x55d6db271d38 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1422
          #17 0x55d6db27172e in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1319
          #18 0x55d6dbea8a65 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:1869
          #19 0x7f9e673104a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      SUMMARY: AddressSanitizer: 856 byte(s) leaked in 2 allocation(s).
      200208 21:55:27 [ERROR] mysqld got signal 6 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
       
      To report this bug, see https://mariadb.com/kb/en/reporting-bugs
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed, 
      something is definitely wrong and this may fail.
       
      Server version: 10.5.1-MariaDB-debug-log
      read_buffer_size=131072
      max_used_connections=1
      thread_count=0
      Thread pointer: 0x0
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x0 thread_stack 0x5fc00
      /usr/lib/x86_64-linux-gnu/libasan.so.3(backtrace+0x41)[0x7f9e67573681]
      /data/bld/10.5-asan-nightly/bin/mysqld(my_print_stacktrace+0xb5)[0x55d6dc8ad865]
      /data/bld/10.5-asan-nightly/bin/mysqld(handle_fatal_signal+0x873)[0x55d6db5fd663]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0)[0x7f9e6731a0e0]
      /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf)[0x7f9e6538efff]
      /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f9e6539042a]
      /usr/lib/x86_64-linux-gnu/libasan.so.3(+0xdb329)[0x7f9e67601329]
      /usr/lib/x86_64-linux-gnu/libasan.so.3(+0xd09ab)[0x7f9e675f69ab]
      /usr/lib/x86_64-linux-gnu/libasan.so.3(+0xe5e66)[0x7f9e6760be66]
      /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0x8f)[0x7f9e65391caf]
      /usr/lib/x86_64-linux-gnu/libasan.so.3(+0x1f4c3)[0x7f9e675454c3]
      The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /dev/shm/var_memleak1/mysqld.1/data
      Resource Limits:
      ASAN:DEADLYSIGNAL
      =================================================================
      ==21075==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55d6dc8a2c6a bp 0x7ffeceb4d9d0 sp 0x7ffeceb4d900 T0)
          #0 0x55d6dc8a2c69 in my_read /data/src/10.5/mysys/my_read.c:63
          #1 0x55d6db5fccdc in output_core_info /data/src/10.5/sql/signal_handler.cc:66
          #2 0x55d6db5fdc18 in handle_fatal_signal /data/src/10.5/sql/signal_handler.cc:339
          #3 0x7f9e6731a0df  (/lib/x86_64-linux-gnu/libpthread.so.0+0x110df)
          #4 0x7f9e6538effe in raise (/lib/x86_64-linux-gnu/libc.so.6+0x32ffe)
          #5 0x7f9e65390429 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x34429)
          #6 0x7f9e67601328  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xdb328)
          #7 0x7f9e675f69aa  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd09aa)
          #8 0x7f9e6760be65  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xe5e65)
          #9 0x7f9e65391cae in __cxa_finalize (/lib/x86_64-linux-gnu/libc.so.6+0x35cae)
          #10 0x7f9e675454c2  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x1f4c2)
       
      AddressSanitizer can not provide additional info.
      SUMMARY: AddressSanitizer: SEGV /data/src/10.5/mysys/my_read.c:63 in my_read
      

      Not reproducible on 10.4.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: