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

Segmentation fault due to Deep Recursion in table.cc and sql_lex.cc

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.3.0, 10.4(EOL), 10.5, 10.6, 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6, 10.11
    • Optimizer - CTE, Server
    • None
    • Ubuntu 20.04

    Description

      Run these queries in debug build:

      CREATE TABLE x ( x INT ) ;
      INSERT INTO x ( x ) VALUES ( 1 ) ;
      UPDATE x SET x = 1 WHERE x = 1 ;
      INSERT INTO x ( x ) VALUES ( 1 ) , ( 1 ) ;
      WITH RECURSIVE x ( x ) AS ( WITH x ( x ) AS ( SELECT 1 EXCEPT SELECT x ^ 1 FROM x ) SELECT 1 FROM x AS x EXCEPT SELECT x + 1 FROM x ) SELECT - x , x FROM x ;

      Will trigger Segmentation fault.
      GDB info:
      #0 0x00005555575ce774 in TABLE_LIST::handle_derived (this=0x0, lex=0x0, phases=0) at /home/wx/mariadb-11.3.0/sql/table.cc:9638
      #1 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001e45f8, table_list=0x629000164f58, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #2 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001619e8, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #3 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x62900015e758, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #4 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001e45f8, table_list=0x62900015e758, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #5 0x0000555557143da1 in st_select_lex::handle_derived (this=0x62900015e2a8, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #6 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x629000164f58, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #7 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001e45f8, table_list=0x629000164f58, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001619e8, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #9 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x62900015e758, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #10 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001e45f8, table_list=0x62900015e758, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #11 0x0000555557143da1 in st_select_lex::handle_derived (this=0x62900015e2a8, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #12 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x629000164f58, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #13 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001e45f8, table_list=0x629000164f58, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #14 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001619e8, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #15 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x62900015e758, lex=0x62c0001e45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      .....................................................................
      #8806 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x629000136758, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8807 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001362a8, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8808 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x62900015ff58, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #8809 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x62900015ff58, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8810 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001399e8, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8811 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x629000136758, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #8812 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x629000136758, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8813 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001362a8, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8814 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x62900015ff58, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #8815 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x62900015ff58, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8816 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001399e8, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8817 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x629000136758, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #8818 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x629000136758, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8819 0x0000555557143da1 in st_select_lex::handle_derived (this=0x6290001362a8, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8820 0x00005555575ce8d7 in TABLE_LIST::handle_derived (this=0x629000137c48, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/table.cc:9648
      #8821 0x000055555711d7d6 in LEX::handle_list_of_derived (this=0x62c0001d45f8, table_list=0x629000137c48, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.h:4579
      #8822 0x0000555557143da1 in st_select_lex::handle_derived (this=0x629000137438, lex=0x62c0001d45f8, phases=2) at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4989
      #8823 0x00005555572b563d in JOIN::prepare (this=0x629000160ba8, tables_init=0x629000137c48, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0,
      having_init=0x0, proc_param_init=0x0, select_lex_arg=0x629000137438, unit_arg=0x62c0001d46d8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1439
      #8824 0x00005555572dd916 in mysql_select (thd=0x62c0001d0288, tables=0x629000137c48, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0,
      select_options=2164525824, result=0x62900013a238, unit=0x62c0001d46d8, select_lex=0x629000137438) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:5224
      #8825 0x00005555572ad18a in handle_select (thd=0x62c0001d0288, lex=0x62c0001d45f8, result=0x62900013a238, setup_tables_done_option=0) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:628
      #8826 0x00005555571ce583 in execute_sqlcom_select (thd=0x62c0001d0288, all_tables=0x629000137c48) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:6013
      #8827 0x00005555571becf6 in mysql_execute_command (thd=0x62c0001d0288, is_called_from_prepared_stmt=false) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:3912
      #8828 0x00005555571d95e2 in mysql_parse (thd=0x62c0001d0288,
      rawbuf=0x6290000f52a8 "WITH RECURSIVE x ( x ) AS ( WITH x ( x ) AS ( SELECT 1 EXCEPT SELECT x ^ 1 FROM x ) SELECT 1 FROM x AS x EXCEPT SELECT x + 1 FROM x ) SELECT - x , x FROM x", length=155, parser_state=0x7fffd2e91870) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:7734
      #8829 0x00005555571b1237 in dispatch_command (command=COM_QUERY, thd=0x62c0001d0288,
      packet=0x6290000eb289 "WITH RECURSIVE x ( x ) AS ( WITH x ( x ) AS ( SELECT 1 EXCEPT SELECT x ^ 1 FROM x ) SELECT 1 FROM x AS x EXCEPT SELECT x + 1 FROM x ) SELECT - x , x FROM x", packet_length=155, blocking=true) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1893
      #8830 0x00005555571adf7c in do_command (thd=0x62c0001d0288, blocking=true) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
      #8831 0x000055555768e557 in do_handle_one_connection (connect=0x6110000447c8, put_in_cache=true) at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
      #8832 0x000055555768deb4 in handle_one_connection (arg=0x6110000447c8) at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
      #8833 0x00005555582fa350 in pfs_spawn_thread (arg=0x618000006508) at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
      #8834 0x00007ffff7115609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
      #8835 0x00007ffff6ce8133 in clone () from /lib/x86_64-linux-gnu/libc.so.6

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              Xin Wen Xin Wen
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.