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

Memory leak in Create_tmp_table::start / select_materialize_with_stats::create_result_table

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.6, 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.6, 10.11
    • Optimizer

    Description

      Set to critical because it's a recent regression, but not to a blocker because it's a test case with an erroneous query on a constant table performed under a non-default optimizer switch – I think it qualifies as a corner case.

      CREATE TABLE t (a DATE, b INT);
      INSERT INTO t VALUES ('2012-12-12',1);
       
      SET SESSION optimizer_switch='semijoin=off,in_to_exists=off,materialization=on';
       
      --error ER_TRUNCATED_WRONG_VALUE
      CREATE TABLE t2 AS SELECT b FROM t WHERE b IN (SELECT b FROM t WHERE a = 1);
       
      # Cleanup
      DROP TABLE t;
      

      10.6 4941ac91 with debug_assert_on_not_freed_memory=0

      Warning: Memory not freed: 136
       
      =================================================================
      ==2037104==ERROR: LeakSanitizer: detected memory leaks
       
      Indirect leak of 3584 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172f5c7da0 in alloc_root /data/src/10.6/mysys/my_alloc.c:256
          #3 0x56172f5c851f in multi_alloc_root /data/src/10.6/mysys/my_alloc.c:332
          #4 0x56172da6216f in Create_tmp_table::start(THD*, TMP_TABLE_PARAM*, st_mysql_const_lex_string const*) /data/src/10.6/sql/sql_select.cc:19403
          #5 0x56172da6d7e4 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20259
          #6 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #7 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #8 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #9 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #10 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #11 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #12 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #13 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #14 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #15 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #16 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #17 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #18 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #19 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #20 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #21 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #22 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #23 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #24 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #25 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
          #26 0x56172dd82ffa in handle_one_connection /data/src/10.6/sql/sql_connect.cc:1318
          #27 0x56172e9e67b5 in pfs_spawn_thread /data/src/10.6/storage/perfschema/pfs.cc:2201
          #28 0x7fa8490a7fd3 in start_thread nptl/pthread_create.c:442
       
      Indirect leak of 1616 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172ebb4464 in heap_create /data/src/10.6/storage/heap/hp_create.c:162
          #3 0x56172eb95b11 in ha_heap::open(char const*, int, unsigned int) /data/src/10.6/storage/heap/ha_heap.cc:104
          #4 0x56172e1a8706 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /data/src/10.6/sql/handler.cc:3377
          #5 0x56172da6fb46 in open_tmp_table(TABLE*) /data/src/10.6/sql/sql_select.cc:20462
          #6 0x56172da7632a in instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) /data/src/10.6/sql/sql_select.cc:21368
          #7 0x56172da6c2fa in Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool) /data/src/10.6/sql/sql_select.cc:20174
          #8 0x56172da6d860 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20261
          #9 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #10 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #11 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #12 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #13 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #14 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #15 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #16 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #17 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #18 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #19 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #20 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #21 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #22 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #23 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #24 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #25 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #26 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #27 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #28 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
          #29 0x56172dd82ffa in handle_one_connection /data/src/10.6/sql/sql_connect.cc:1318
       
      Indirect leak of 1416 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172f5c7da0 in alloc_root /data/src/10.6/mysys/my_alloc.c:256
          #3 0x56172d62495b in Sql_alloc::operator new(unsigned long, st_mem_root*) /data/src/10.6/sql/sql_alloc.h:37
          #4 0x56172eb95645 in heap_create_handler /data/src/10.6/storage/heap/ha_heap.cc:65
          #5 0x56172e194b9b in get_new_handler(TABLE_SHARE*, st_mem_root*, handlerton*) /data/src/10.6/sql/handler.cc:379
          #6 0x56172da65ed6 in Create_tmp_table::choose_engine(THD*, TABLE*, TMP_TABLE_PARAM*) /data/src/10.6/sql/sql_select.cc:19721
          #7 0x56172da66693 in Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool) /data/src/10.6/sql/sql_select.cc:19754
          #8 0x56172da6d860 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20261
          #9 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #10 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #11 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #12 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #13 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #14 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #15 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #16 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #17 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #18 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #19 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #20 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #21 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #22 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #23 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #24 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #25 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #26 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #27 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #28 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
          #29 0x56172dd82ffa in handle_one_connection /data/src/10.6/sql/sql_connect.cc:1318
       
      Indirect leak of 1008 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172f5c7da0 in alloc_root /data/src/10.6/mysys/my_alloc.c:256
          #3 0x56172f5c9438 in memdup_root /data/src/10.6/mysys/my_alloc.c:498
          #4 0x56172e108f15 in Field::make_new_field(st_mem_root*, TABLE*, bool) /data/src/10.6/sql/field.cc:2528
          #5 0x56172e1093fc in Field::create_tmp_field(st_mem_root*, TABLE*, bool) /data/src/10.6/sql/field.cc:2587
          #6 0x56172da5e305 in Item_field::create_tmp_field_from_item_field(st_mem_root*, TABLE*, Item_ref*, Tmp_field_param const*) /data/src/10.6/sql/sql_select.cc:18977
          #7 0x56172da5e61e in Item_field::create_tmp_field_ex(st_mem_root*, TABLE*, Tmp_field_src*, Tmp_field_param const*) /data/src/10.6/sql/sql_select.cc:18994
          #8 0x56172da5fcef in create_tmp_field(TABLE*, Item*, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.6/sql/sql_select.cc:19172
          #9 0x56172da6488c in Create_tmp_table::add_fields(THD*, TABLE*, TMP_TABLE_PARAM*, List<Item>&) /data/src/10.6/sql/sql_select.cc:19609
          #10 0x56172da6d823 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20260
          #11 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #12 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #13 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #14 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #15 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #16 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #17 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #18 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #19 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #20 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #21 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #22 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #23 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #24 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #25 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #26 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #27 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #28 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #29 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
       
      Indirect leak of 776 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172eba731f in heap_open_from_share /data/src/10.6/storage/heap/hp_open.c:33
          #3 0x56172eb95c70 in ha_heap::open(char const*, int, unsigned int) /data/src/10.6/storage/heap/ha_heap.cc:111
          #4 0x56172e1a8706 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /data/src/10.6/sql/handler.cc:3377
          #5 0x56172da6fb46 in open_tmp_table(TABLE*) /data/src/10.6/sql/sql_select.cc:20462
          #6 0x56172da7632a in instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) /data/src/10.6/sql/sql_select.cc:21368
          #7 0x56172da6c2fa in Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool) /data/src/10.6/sql/sql_select.cc:20174
          #8 0x56172da6d860 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20261
          #9 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #10 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #11 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #12 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #13 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #14 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #15 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #16 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #17 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #18 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #19 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #20 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #21 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #22 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #23 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #24 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #25 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #26 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #27 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #28 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
          #29 0x56172dd82ffa in handle_one_connection /data/src/10.6/sql/sql_connect.cc:1318
       
      Indirect leak of 104 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172f5ec751 in my_strdup /data/src/10.6/mysys/my_malloc.c:235
          #3 0x56172ebb516a in heap_create /data/src/10.6/storage/heap/hp_create.c:226
          #4 0x56172eb95b11 in ha_heap::open(char const*, int, unsigned int) /data/src/10.6/storage/heap/ha_heap.cc:104
          #5 0x56172e1a8706 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /data/src/10.6/sql/handler.cc:3377
          #6 0x56172da6fb46 in open_tmp_table(TABLE*) /data/src/10.6/sql/sql_select.cc:20462
          #7 0x56172da7632a in instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) /data/src/10.6/sql/sql_select.cc:21368
          #8 0x56172da6c2fa in Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool) /data/src/10.6/sql/sql_select.cc:20174
          #9 0x56172da6d860 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20261
          #10 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #11 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #12 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #13 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #14 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #15 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #16 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #17 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #18 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #19 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #20 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #21 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #22 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #23 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #24 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #25 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #26 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #27 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #28 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #29 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
       
      Indirect leak of 32 byte(s) in 1 object(s) allocated from:
          #0 0x7fa849cb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x56172f5eb5b7 in my_malloc /data/src/10.6/mysys/my_malloc.c:91
          #2 0x56172d95a5ab in intern_plugin_lock /data/src/10.6/sql/sql_plugin.cc:994
          #3 0x56172d95aab8 in plugin_lock(THD*, st_plugin_int**) /data/src/10.6/sql/sql_plugin.cc:1052
          #4 0x56172e1948e1 in ha_lock_engine(THD*, handlerton const*) /data/src/10.6/sql/handler.cc:332
          #5 0x56172da65e6b in Create_tmp_table::choose_engine(THD*, TABLE*, TMP_TABLE_PARAM*) /data/src/10.6/sql/sql_select.cc:19720
          #6 0x56172da66693 in Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool) /data/src/10.6/sql/sql_select.cc:19754
          #7 0x56172da6d860 in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.6/sql/sql_select.cc:20261
          #8 0x56172d803b08 in select_materialize_with_stats::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.6/sql/sql_class.cc:4339
          #9 0x56172e3ef341 in subselect_hash_sj_engine::init(List<Item>*, unsigned int) /data/src/10.6/sql/item_subselect.cc:5188
          #10 0x56172e3e3a64 in Item_in_subselect::setup_mat_engine() /data/src/10.6/sql/item_subselect.cc:3606
          #11 0x56172de9e5f7 in JOIN::choose_subquery_plan(unsigned long long) /data/src/10.6/sql/opt_subselect.cc:6701
          #12 0x56172da0a7e4 in make_join_statistics /data/src/10.6/sql/sql_select.cc:6025
          #13 0x56172d9e670c in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2531
          #14 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #15 0x56172d8ac356 in st_select_lex::optimize_unflattened_subqueries(bool) /data/src/10.6/sql/sql_lex.cc:4902
          #16 0x56172de97b4e in JOIN::optimize_unflattened_subqueries() /data/src/10.6/sql/opt_subselect.cc:5675
          #17 0x56172d9eccb2 in JOIN::optimize_stage2() /data/src/10.6/sql/sql_select.cc:3136
          #18 0x56172d9e69ee in JOIN::optimize_inner() /data/src/10.6/sql/sql_select.cc:2557
          #19 0x56172d9df64c in JOIN::optimize() /data/src/10.6/sql/sql_select.cc:1868
          #20 0x56172da010b3 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.6/sql/sql_select.cc:5077
          #21 0x56172d9d0d6f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.6/sql/sql_select.cc:559
          #22 0x56172dbea446 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.6/sql/sql_table.cc:11980
          #23 0x56172d932f81 in mysql_execute_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:6026
          #24 0x56172d9403a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6/sql/sql_parse.cc:8050
          #25 0x56172d916047 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6/sql/sql_parse.cc:1896
          #26 0x56172d912d7b in do_command(THD*, bool) /data/src/10.6/sql/sql_parse.cc:1409
          #27 0x56172dd83639 in do_handle_one_connection(CONNECT*, bool) /data/src/10.6/sql/sql_connect.cc:1416
          #28 0x56172dd82ffa in handle_one_connection /data/src/10.6/sql/sql_connect.cc:1318
          #29 0x56172e9e67b5 in pfs_spawn_thread /data/src/10.6/storage/perfschema/pfs.cc:2201
       
      SUMMARY: AddressSanitizer: 8536 byte(s) leaked in 7 allocation(s).
      231021  0:01:13 [ERROR] mysqld got signal 6 ;
      

      with debug_assert_on_not_freed_memory=1 (default)

      mariadbd: /data/src/10.6/sql/sql_class.cc:1770: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed.
      231021  0:05:21 [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.6.16-MariaDB-debug-log source revision: 4941ac9192394a1489f0bf01b6dd2ee5ec2906c9
      key_buffer_size=1048576
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=1
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63904 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x62b00007e218
      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 = 0x7f27f30e3bd0 thread_stack 0x100000
      sanitizer_common/sanitizer_common_interceptors.inc:4277(__interceptor_backtrace.part.0)[0x7f27fb451f31]
      mysys/stacktrace.c:215(my_print_stacktrace)[0x55c5b83e265a]
      sql/signal_handler.cc:241(handle_fatal_signal)[0x55c5b6f74613]
      libc_sigaction.c:0(__restore_rt)[0x7f27fa85af90]
      nptl/pthread_kill.c:44(__pthread_kill_implementation)[0x7f27fa8a9ccc]
      posix/raise.c:27(__GI_raise)[0x7f27fa85aef2]
      stdlib/abort.c:81(__GI_abort)[0x7f27fa845472]
      intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f27fa845395]
      /lib/x86_64-linux-gnu/libc.so.6(+0x34df2)[0x7f27fa853df2]
      sql/sql_class.cc:1773(THD::~THD())[0x55c5b65d2e9b]
      sql/sql_class.cc:1776(THD::~THD())[0x55c5b65d321a]
      sql/sql_connect.cc:1359(do_handle_one_connection(CONNECT*, bool))[0x55c5b6b69be0]
      sql/sql_connect.cc:1320(handle_one_connection)[0x55c5b6b68ffb]
      perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55c5b77cc7b6]
      nptl/pthread_create.c:442(start_thread)[0x7f27fa8a7fd4]
      x86_64/clone3.S:83(clone3)[0x7f27fa9285bc]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x0): (null)
      Connection ID (thread ID): 7
      Status: KILL_CONNECTION
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=off,cset_narrowing=off
       
      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
      information that should help you find out what is causing the crash.
       
      We think the query pointer is invalid, but we will try to print it anyway. 
      Query: 
       
      Writing a core file...
      Working directory at /dev/shm/var_auto_N3RA/mysqld.1/data
      Resource Limits:
      Limit                     Soft Limit           Hard Limit           Units     
      Max cpu time              unlimited            unlimited            seconds   
      Max file size             unlimited            unlimited            bytes     
      Max data size             unlimited            unlimited            bytes     
      Max stack size            8388608              unlimited            bytes     
      Max core file size        unlimited            unlimited            bytes     
      Max resident set          unlimited            unlimited            bytes     
      Max processes             385718               385718               processes 
      Max open files            65536                65536                files     
      Max locked memory         12648972288          12648972288          bytes     
      Max address space         unlimited            unlimited            bytes     
      Max file locks            unlimited            unlimited            locks     
      Max pending signals       385718               385718               signals   
      Max msgqueue size         819200               819200               bytes     
      Max nice priority         0                    0                    
      Max realtime priority     0                    0                    
      Max realtime timeout      unlimited            unlimited            us        
      Core pattern: core
      

      The failure started happening after this commit in 10.6:

      commit ca5c122adcd39c34b1bd7059903668586496caf6
      Author: Monty
      Date:   Fri Aug 11 17:59:40 2023 +0300
       
          MDEV-9938 Prepared statement return wrong result (missing row)
       
          The problem is that the first execution of the prepared statement makes
      

      Attachments

        Activity

          People

            monty Michael Widenius
            elenst Elena Stepanova
            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.