Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-5321

MCS plugin crashes MDB runtime for IN with a long(>4000) list of literals

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 22.08.4, 6.4.6
    • None
    • None

    Description

      The core files shared by RDBA team gives me the exact query that crashes MDB runtime with SEGV. The fast research suggested the immediate workaround, namely to increase per-thread stack space allowance in mariadbd systemd unit.
      MDB represents long IN lists with a tree-sh structure. MDB runtime goes down this tree when CSEP dtor is called. When runtime goes as deep as approximately 12k function calls the stack allowance is exhausted and SEGV is called. The long-term solution would be to refactor the way MCS represents a long IN + literal values list.
      Here is the backtrace extracted. Pay attention to the stack depth.

      #12062 0x00007f1f28fa07e9 in ~ParseTree (this=0x7f1d17db6590, __in_chrg=<optimized out>) at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/parsetree.h:350
      #12063 execplan::ParseTree::~ParseTree (this=0x7f1d17db6590, __in_chrg=<optimized out>) at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/parsetree.h:361
      #12064 0x00007f1f28fa07e9 in ~ParseTree (this=0x7f1d17db68b0, __in_chrg=<optimized out>) at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/parsetree.h:350
      #12065 execplan::ParseTree::~ParseTree (this=0x7f1d17db68b0, __in_chrg=<optimized out>) at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/parsetree.h:361
      #12066 0x00007f1f1b2e8291 in execplan::CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan (this=0x7f1e501467a0, __in_chrg=<optimized out>)
          at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/calpontselectexecutionplan.cpp:165
      #12067 0x00007f1f1b2e8521 in execplan::CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan (this=0x7f1e501467a0, __in_chrg=<optimized out>)
          at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/execplan/calpontselectexecutionplan.cpp:192
      #12068 0x00007f1f28f1d51e in boost::detail::sp_counted_base::release (this=0x7f1e5003b2d0) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
      #12069 0x00007f1f28f47c2e in ha_mcs_impl_pushdown_init (handler_info=handler_info@entry=0x7f1ef663a720, table=0x7f1e50080a60) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:371
      #12070 0x00007f1f28f2b155 in create_columnstore_select_handler (thd=0x7f1e500009b8, select_lex=0x7f1e50010890) at /usr/src/debug/MariaDB-/src_0/storage/columnstore/columnstore/dbcon/mysql/ha_mcs_pushdown.cpp:932
      #12071 0x000056478033ed88 in mysql_select (thd=thd@entry=0x7f1e500009b8, tables=0x7f1e50013120, fields=..., conds=0x7f1e5007f1d0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, 
          result=result@entry=0x7f1e51320430, unit=unit@entry=0x7f1e50004b60, select_lex=select_lex@entry=0x7f1e50010890) at /usr/src/debug/MariaDB-/src_0/sql/sql_select.cc:5011
      #12072 0x000056478033f6a4 in handle_select (thd=thd@entry=0x7f1e500009b8, lex=lex@entry=0x7f1e50004a98, result=result@entry=0x7f1e51320430, setup_tables_done_option=setup_tables_done_option@entry=0)
          at /usr/src/debug/MariaDB-/src_0/sql/sql_select.cc:557
      #12073 0x00005647801a2476 in execute_sqlcom_select (thd=thd@entry=0x7f1e500009b8, all_tables=0x7f1e50013120) at /usr/src/debug/MariaDB-/src_0/sql/sql_parse.cc:6281
      #12074 0x00005647802e2002 in mysql_execute_command (thd=thd@entry=0x7f1e500009b8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /usr/src/debug/MariaDB-/src_0/sql/sql_parse.cc:3959
      #12075 0x00005647802e43db in mysql_parse (thd=thd@entry=0x7f1e500009b8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f1ef663b3c0) at /usr/src/debug/MariaDB-/src_0/sql/sql_parse.cc:8056
      #12076 0x00005647802e677d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f1e500009b8, 
          packet=packet@entry=0x7f1e501af829 "select count(distinct IF(FAIT_ASSIGNMENTS.ASS_CONTRACTVERSION NOT LIKE '%AN', CONCAT(FAIT_ASSIGNMENTS.ASS_ID, '-',FAIT_ASSIGNMENTS.ORIGINE),NULL)) as `m0`, count(distinct IF(FAIT_ASSIGNMENTS.CTR_EST_A"..., packet_length=packet_length@entry=920754, blocking=blocking@entry=true) at /usr/src/debug/MariaDB-/src_0/sql/sql_parse.cc:1903
      #12077 0x00005647802e7cee in do_command (thd=0x7f1e500009b8, blocking=blocking@entry=true) at /usr/src/debug/MariaDB-/src_0/sql/sql_parse.cc:1412
      #12078 0x00005647803dd8b7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5647835e6118, put_in_cache=put_in_cache@entry=true) at /usr/src/debug/MariaDB-/src_0/sql/sql_connect.cc:1418
      #12079 0x00005647803ddb54 in handle_one_connection (arg=arg@entry=0x5647835e6118) at /usr/src/debug/MariaDB-/src_0/sql/sql_connect.cc:1312
      #12080 0x0000564780776cec in pfs_spawn_thread (arg=0x5647836892f8) at /usr/src/debug/MariaDB-/src_0/storage/perfschema/pfs.cc:2201
      #12081 0x00007f1f2c55bea5 in start_thread (arg=0x7f1ef663c700) at pthread_create.c:307
      #12082 0x00007f1f2ba76b0d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Ask me about the actual query that crashes the server.

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              drrtuy Roman
              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.