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

Server crash on 2nd execution query SELECT from view of prepare statement if query has impossible HAVING

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.10, 10.11, 11.0, 11.1, 11.2
    • 10.4, 10.5, 10.6, 10.11, 11.1, 11.2
    • None
    • None

    Description

      After fix enable "ps2-protocol" for cases marked with MDEV-31937

      Testcase (fails on second execution of prepare statement):

      CREATE TABLE t1 (
        col1 int(8),
        col2 int(10)
      ) ENGINE=MyISAM;
       
      CREATE VIEW v1 AS SELECT col2, (SELECT col1 FROM t1 HAVING col2=1) FROM (SELECT * FROM t1) as a;
      explain SELECT * FROM v1;
       
      prepare stmt from "SELECT * FROM v1";
      execute stmt;
      execute stmt;
      deallocate prepare stmt;
       
      drop view v1;
      drop table t1;
      

      Stacktrace:

      Thread pointer: 0x7fd688000dc8
      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 = 0x7fd699defc38 thread_stack 0x49000
      mysys/stacktrace.c:215(my_print_stacktrace)[0x55f8ba914898]
      sql/signal_handler.cc:241(handle_fatal_signal)[0x55f8b9fda36c]
      libc_sigaction.c:0(__restore_rt)[0x7fd69f042520]
      nptl/pthread_kill.c:44(__pthread_kill_implementation)[0x7fd69f096a7c]
      posix/raise.c:27(__GI_raise)[0x7fd69f042476]
      stdlib/abort.c:81(__GI_abort)[0x7fd69f0287f3]
      intl/loadmsgcat.c:1177(_nl_load_domain)[0x7fd69f02871b]
      /lib/x86_64-linux-gnu/libc.so.6(+0x39e96)[0x7fd69f039e96]
      sql/item.cc:5545(resolve_ref_in_select_and_group(THD*, Item_ident*, st_select_lex*))[0x55f8ba011d3e]
      sql/item.cc:8104(Item_ref::fix_fields(THD*, Item**))[0x55f8ba01949a]
      sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55f8b9a91b44]
      sql/item_func.cc:349(Item_func::fix_fields(THD*, Item**))[0x55f8ba07003a]
      sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55f8b9a91b44]
      sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x55f8b9a91b7d]
      sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x55f8b9b1b615]
      sql/sql_select.cc:1588(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55f8b9c2ddc3]
      sql/item_subselect.cc:3943(subselect_single_select_engine::prepare(THD*))[0x55f8ba1069ed]
      sql/item_subselect.cc:296(Item_subselect::fix_fields(THD*, Item**))[0x55f8ba0f7e92]
      sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55f8b9a91b44]
      sql/item.cc:9235(Item_direct_view_ref::fix_fields(THD*, Item**))[0x55f8ba01d8d9]
      sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55f8b9a91b44]
      sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x55f8b9a91b7d]
      sql/sql_base.cc:8054(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_column_usage, List<Item>*, List<Item>*, bool))[0x55f8b9b14ed9]
      sql/sql_select.cc:1525(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55f8b9c2d8be]
      sql/sql_select.cc:5214(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*))[0x55f8b9c3b4c4]
      sql/sql_select.cc:627(handle_select(THD*, LEX*, select_result*, unsigned long long))[0x55f8b9c29d84]
      sql/sql_parse.cc:6030(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55f8b9bcd239]
      sql/sql_parse.cc:3944(mysql_execute_command(THD*, bool))[0x55f8b9bc5281]
      sql/sql_prepare.cc:4989(Prepared_statement::execute(String*, bool))[0x55f8b9c0e9b0]
      sql/sql_prepare.cc:4414(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55f8b9c0ca80]
      sql/sql_prepare.cc:3457(mysql_sql_stmt_execute(THD*))[0x55f8b9c09fbb]
      sql/sql_parse.cc:3961(mysql_execute_command(THD*, bool))[0x55f8b9bc52c6]
      sql/sql_parse.cc:7769(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55f8b9bd214f]
      sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55f8b9bbef9c]
      sql/sql_parse.cc:1405(do_command(THD*, bool))[0x55f8b9bbd8e2]
      sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55f8b9db4aaa]
      sql/sql_connect.cc:1320(handle_one_connection)[0x55f8b9db4813]
      perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55f8ba356449]
      nptl/pthread_create.c:442(start_thread)[0x7fd69f094b43]
      x86_64/clone3.S:83(__clone3)[0x7fd69f126a00]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fd6880155f0): SELECT * FROM v1
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              lstartseva Lena Startseva
              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.