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

LeakSanitizer: detected memory leaks on PREPARE with CHANGE MASTER

    XMLWordPrintable

Details

    Description

      PREPARE p FROM 'CHANGE MASTER TO IGNORE_server_ids=(1,2,3);';
      SHUTDOWN;
      

      Leads to:

      11.5.0 3f9182126c64bcec359bebe9ebad2a0e559b13e2 (Optimized, UBASAN)

      2024-04-26 14:53:20 0 [Note] /test/UBASAN_MD240424-mariadb-11.5.0-linux-x86_64-opt/bin/mariadbd: Shutdown complete
       
      Warning: Memory not freed: 152
       
      =================================================================
      ==2332637==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 152 byte(s) in 1 object(s) allocated from:
          #0 0x5620aeea3f4f in malloc (/test/UBASAN_MD240424-mariadb-11.5.0-linux-x86_64-opt/bin/mariadbd+0x7f72f4f)
          #1 0x5620b352c315 in my_malloc /test/11.5_opt_san/mysys/my_malloc.c:93
          #2 0x5620b34aabd8 in alloc_dynamic /test/11.5_opt_san/mysys/array.c:188
          #3 0x5620b34aae57 in insert_dynamic /test/11.5_opt_san/mysys/array.c:97
          #4 0x5620b0a41af3 in MYSQLparse(THD*) /test/11.5_opt_san/sql/sql_yacc.yy:2346
          #5 0x5620af77af34 in parse_sql(THD*, Parser_state*, Object_creation_ctx*, bool) /test/11.5_opt_san/sql/sql_parse.cc:10168
          #6 0x5620af87d0a6 in Prepared_statement::prepare(char const*, unsigned int) /test/11.5_opt_san/sql/sql_prepare.cc:4183
          #7 0x5620af8b0b52 in mysql_sql_stmt_prepare(THD*) /test/11.5_opt_san/sql/sql_prepare.cc:2817
          #8 0x5620af790457 in mysql_execute_command(THD*, bool) /test/11.5_opt_san/sql/sql_parse.cc:3953
          #9 0x5620af7a2aed in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.5_opt_san/sql/sql_parse.cc:7815
          #10 0x5620af7b0519 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.5_opt_san/sql/sql_parse.cc:1892
          #11 0x5620af7bace3 in do_command(THD*, bool) /test/11.5_opt_san/sql/sql_parse.cc:1405
          #12 0x5620b014c887 in do_handle_one_connection(CONNECT*, bool) /test/11.5_opt_san/sql/sql_connect.cc:1445
          #13 0x5620b014f27c in handle_one_connection /test/11.5_opt_san/sql/sql_connect.cc:1347
          #14 0x14bb2b08f189 in start_thread nptl/pthread_create.c:444
       
      SUMMARY: AddressSanitizer: 152 byte(s) leaked in 1 allocation(s).
      240426 14:53:22 [ERROR] mysqld got signal 6 ;
      

      11.5.0 3f9182126c64bcec359bebe9ebad2a0e559b13e2 (Debug, UBASAN)

      2024-04-26 15:02:06 0 [Note] /test/UBASAN_MD240424-mariadb-11.5.0-linux-x86_64-dbg/bin/mariadbd: Shutdown complete
       
      Warning: Memory not freed: 152
       
      =================================================================
      ==3098523==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 152 byte(s) in 1 object(s) allocated from:
          #0 0x561110e6aa1f in __interceptor_malloc (/test/UBASAN_MD240424-mariadb-11.5.0-linux-x86_64-dbg/bin/mariadbd+0x7ec8a1f)
          #1 0x5611157d7fac in my_malloc /test/11.5_dbg_san/mysys/my_malloc.c:93
          #2 0x5611157d85b4 in my_realloc /test/11.5_dbg_san/mysys/my_malloc.c:149
          #3 0x56111576bd15 in alloc_dynamic /test/11.5_dbg_san/mysys/array.c:188
          #4 0x56111576bea9 in insert_dynamic /test/11.5_dbg_san/mysys/array.c:97
          #5 0x561112af0072 in MYSQLparse(THD*) /test/11.5_dbg_san/sql/sql_yacc.yy:2346
          #6 0x5611117b9a5a in parse_sql(THD*, Parser_state*, Object_creation_ctx*, bool) /test/11.5_dbg_san/sql/sql_parse.cc:10168
          #7 0x5611118d7a21 in Prepared_statement::prepare(char const*, unsigned int) /test/11.5_dbg_san/sql/sql_prepare.cc:4183
          #8 0x561111908a0f in mysql_sql_stmt_prepare(THD*) /test/11.5_dbg_san/sql/sql_prepare.cc:2817
          #9 0x5611117c8e29 in mysql_execute_command(THD*, bool) /test/11.5_dbg_san/sql/sql_parse.cc:3953
          #10 0x5611117ef1c5 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.5_dbg_san/sql/sql_parse.cc:7815
          #11 0x5611117ff546 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.5_dbg_san/sql/sql_parse.cc:1892
          #12 0x56111180e387 in do_command(THD*, bool) /test/11.5_dbg_san/sql/sql_parse.cc:1405
          #13 0x56111224654b in do_handle_one_connection(CONNECT*, bool) /test/11.5_dbg_san/sql/sql_connect.cc:1445
          #14 0x561112247af4 in handle_one_connection /test/11.5_dbg_san/sql/sql_connect.cc:1347
          #15 0x149e70a8f189 in start_thread nptl/pthread_create.c:444
       
      SUMMARY: AddressSanitizer: 152 byte(s) leaked in 1 allocation(s).
      240426 15:02:09 [ERROR] mysqld got signal 6 ;
      

      Setup:

      Compiled with a recent version of GCC (I use GCC 12.3.0) and:
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          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
      

      Bug confirmed present in:
      MariaDB: 10.5.25 (dbg), 10.5.25 (opt), 10.6.18 (dbg), 10.6.18 (opt), 10.11.8 (dbg), 10.11.8 (opt), 11.1.5 (dbg), 11.1.5 (opt), 11.2.4 (dbg), 11.2.4 (opt), 11.3.3 (dbg), 11.3.3 (opt), 11.4.2 (dbg), 11.4.2 (opt), 11.5.0 (dbg), 11.5.0 (opt)

      Testcase been used as-is in MTR using an SAN build.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.