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

SIGSEGV in Aggregator_simple::add() on UNINSTALL SONAME racing an in-flight plugin aggregate

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.1
    • 13.1
    • Plugins
    • None
    • Not for Release Notes

    Description

      MTR Testcase (multi-threaded – requires two concurrent connections racing UNINSTALL SONAME against an in-flight aggregate query)

      if (`SELECT @@have_dynamic_loading != 'YES'`) {
        --skip Need dynamic loading
      }
       
      --source include/count_sessions.inc
       
      --disable_query_log
      INSTALL SONAME 'func_test';
       
      CREATE TABLE t_seed (a INT);
      SET @save_max_recursive_iterations= @@max_recursive_iterations;
      SET SESSION max_recursive_iterations= 150;
      INSERT INTO t_seed
        WITH RECURSIVE seq AS
          (SELECT 1 AS n UNION ALL SELECT n + 1 FROM seq WHERE n < 100)
        SELECT n FROM seq;
      SET SESSION max_recursive_iterations= @save_max_recursive_iterations;
      --enable_query_log
       
      connect (con1, localhost, root,,);
      connection con1;
      --send
        SELECT test_plugin_count(a.a) FROM t_seed a, t_seed b;
       
      connection default;
      let $wait_condition=
        SELECT COUNT(*) = 1 FROM information_schema.processlist
        WHERE info LIKE 'SELECT test_plugin_count%';
      --source include/wait_condition.inc
       
      --error 0,ER_PLUGIN_IS_NOT_LOADED,ER_SP_DOES_NOT_EXIST
      UNINSTALL SONAME 'func_test';
       
      connection con1;
      --disable_result_log
      --reap
      --enable_result_log
       
      connection default;
      disconnect con1;
      --source include/wait_until_count_sessions.inc
       
      --disable_query_log
      --error 0,ER_UDF_EXISTS,ER_PLUGIN_IS_NOT_LOADED
      INSTALL SONAME 'func_test';
      --enable_query_log
       
      SELECT test_plugin_count(1);
      SELECT test_plugin_first(1);
       
      DROP TABLE t_seed;
       
      UNINSTALL SONAME 'func_test';
      

      Leads to:

      13.1.0-MariaDB-debug (branch pluggable_aggregate_funcs-13.1 @ cd7b230d901e90995b9143a052f5f92525fead59)

      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005be1a3b1f9ed in Aggregator_simple::add (this=0x7ec4a4016610) at sql/item_sum.h:764
      #1  0x000062335e5e560d in Item_sum::aggregator_add (this=0x785bd0016610) at sql/item_sum.h:572
      #2  0x000062335e635e70 in update_sum_func (func_ptr=0x785bd0018a20) at sql/sql_select.cc:30391
      #3  0x000062335e5c9e70 in end_send_group (join=0x785bd0018130, join_tab=0x785bd001ade0, end_of_records=false) at sql/sql_select.cc:26398
      #4  0x000062335e78456c in JOIN_CACHE::generate_full_extensions (this=0x785bd001bd50, rec_ptr=0x785bd0025b24) at sql/sql_join_cache.cc:2538
      #5  0x000062335e784435 in JOIN_CACHE::join_matching_records (this=0x785bd001bd50, skip_last=false) at sql/sql_join_cache.cc:2430
      #6  0x000062335e783c6d in JOIN_CACHE::join_records (this=0x785bd001bd50, skip_last=false) at sql/sql_join_cache.cc:2180
      #7  0x000062335e5ca2c0 in sub_select_cache (join=0x785bd0018130, join_tab=0x785bd001a968, end_of_records=true) at sql/sql_select.cc:24493
      #8  0x000062335e57c3b6 in sub_select (join=0x785bd0018130, join_tab=0x785bd001a4f0, end_of_records=true) at sql/sql_select.cc:24683
      #9  0x000062335e5a42e1 in do_select (join=0x785bd0018130, procedure=0x0) at sql/sql_select.cc:24263
      #10 0x000062335e5a3641 in JOIN::exec_inner (this=0x785bd0018130) at sql/sql_select.cc:5126
      #11 0x000062335e5a2840 in JOIN::exec (this=0x785bd0018130) at sql/sql_select.cc:4914
      #12 0x000062335e5fcffc in mysql_select (thd=0x785bd0000d60, tables=0x785bd0016810, ...) at sql/sql_select.cc:5440
      #13 0x000062335e5fcad5 in handle_select (thd=0x785bd0000d60, lex=0x785bd0005218, result=0x785bd0018100, setup_tables_done_option=0) at sql/sql_select.cc:637
      #14 0x000062335e599d9d in execute_sqlcom_select (thd=0x785bd0000d60, all_tables=0x785bd0016810) at sql/sql_parse.cc:6229
      #15 0x000062335e58e8b6 in mysql_execute_command (thd=0x785bd0000d60, is_called_from_prepared_stmt=false) at sql/sql_parse.cc:3997
      #16 0x000062335e586974 in mysql_parse (thd=0x785bd0000d60, rawbuf="SELECT test_plugin_count(a.a) FROM t_seed a, t_seed b", length=53, parser_state=0x785c0d230a80) at sql/sql_parse.cc:7968
      #17 0x000062335e583c9d in dispatch_command (command=COM_QUERY, thd=0x785bd0000d60, packet="", packet_length=53, blocking=true) at sql/sql_parse.cc:1903
      #18 0x000062335e587523 in do_command (thd=0x785bd0000d60, blocking=true) at sql/sql_parse.cc:1437
      #19 0x000062335e78c969 in do_handle_one_connection (connect=0x62337dd99610, put_in_cache=true) at sql/sql_connect.cc:1514
      #20 0x000062335e78c70e in handle_one_connection (arg=0x62337dd99610) at sql/sql_connect.cc:1426
      

      13.1.0-MariaDB (optimized) (branch pluggable_aggregate_funcs-13.1 @ cd7b230d901e90995b9143a052f5f92525fead59)

      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000624e8847f37c in Aggregator_simple::add (this=<optimized out>) at sql/item_sum.h:764
      #1  0x0000624e8817e61d in Item_sum::aggregator_add (this=<optimized out>) at sql/item_sum.h:572
      #2  update_sum_func (func_ptr=0x710334016110) at sql/sql_select.cc:30391
      #3  end_send_group (join=0x710334015830, join_tab=<optimized out>, end_of_records=<optimized out>) at sql/sql_select.cc:26398
      #4  0x0000624e88264859 in JOIN_CACHE::generate_full_extensions (this=0x710334019250, rec_ptr=0x710334020947) at sql/sql_join_cache.cc:2538
      #5  JOIN_CACHE::join_matching_records (this=0x710334019250, skip_last=<optimized out>) at sql/sql_join_cache.cc:2430
      #6  0x0000624e88264392 in JOIN_CACHE::join_records (this=0x710334019250, skip_last=false) at sql/sql_join_cache.cc:2180
      #7  0x0000624e8817e969 in sub_select_cache (join=0x710334015830, join_tab=0x710334017fe8, end_of_records=false) at sql/sql_select.cc:24493
      #8  0x0000624e88163d29 in do_select (join=0x710334015830, procedure=<optimized out>) at sql/sql_select.cc:24263
      #9  0x0000624e88162d79 in JOIN::exec_inner (this=0x710334015830) at sql/sql_select.cc:5126
      #10 0x0000624e88149530 in JOIN::exec (this=0x710334015830) at sql/sql_select.cc:4914
      #11 mysql_select (thd=0x710334000c70, tables=<optimized out>, ...) at sql/sql_select.cc:5440
      #12 0x0000624e88149210 in handle_select (thd=0x710334000c70, lex=0x710334005150, result=0x710334015800, setup_tables_done_option=0) at sql/sql_select.cc:637
      #13 0x0000624e88114975 in execute_sqlcom_select (thd=0x710334000c70, all_tables=0x710334013f10) at sql/sql_parse.cc:6229
      #14 0x0000624e881101f1 in mysql_execute_command (thd=0x710334000c70, is_called_from_prepared_stmt=false) at sql/sql_parse.cc:3997
      #15 0x0000624e8810b5d2 in mysql_parse (thd=0x710334000c70, rawbuf="SELECT test_plugin_count(a.a) FROM t_seed a, t_seed b") at sql/sql_parse.cc:7968
      #16 0x0000624e88109b90 in dispatch_command (command=COM_QUERY, thd=0x710334000c70, packet="", packet_length=53, blocking=true) at sql/sql_parse.cc:1903
      #17 0x0000624e8810ba51 in do_command (thd=0x710334000c70, blocking=true) at sql/sql_parse.cc:1437
      #18 0x0000624e8823794d in do_handle_one_connection (connect=0x624eb3e5f930, put_in_cache=true) at sql/sql_connect.cc:1514
      #19 0x0000624e88237782 in handle_one_connection (arg=0x624eb3e5f930) at sql/sql_connect.cc:1426
      
      

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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