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

Crash on query with EXISTS

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.4.8
    • N/A
    • Optimizer
    • None
    • CentOS Linux release 7.7.1908 (Core)
      MariaDB is running with stock configuration from RPM packages, out of MariaDB repository.

    Description

      When we execute the following query the server crashes:

      SELECT * FROM `users` WHERE ( `role` = 1 OR `role` = 10 ) AND EXISTS ( SELECT * FROM `email_templates` INNER JOIN `users_email` ON `email_templates`.`id` = `users_email`.`email_template_id` WHERE `users`.`id` = `users_email`.`user_id` AND `email_template_id` = 12 ) AND `users`.`deleted_at` IS NULL;

      If executed with the value of for example 11 (or any other value) in 'email_template_id' the query works.

      Here the log in MariaDB error file:

      Thread pointer: 0x55d12dc0ed28
      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 = 0x7ff2fd21dcf0 thread_stack 0x49000
      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55d12b70483e]
      /usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x55d12b19ae0f]
      sigaction.c:0(__restore_rt)[0x7ff3153325f0]
      /usr/sbin/mysqld(handler_index_cond_check+0xbf)[0x55d12b1a56af]
      /usr/sbin/mysqld(+0x59ee80)[0x55d12ae94e80]
      /usr/sbin/mysqld(+0xb340cd)[0x55d12b42a0cd]
      /usr/sbin/mysqld(+0xa52c87)[0x55d12b348c87]
      /usr/sbin/mysqld(+0xa52edf)[0x55d12b348edf]
      /usr/sbin/mysqld(_ZN7handler11ha_rnd_nextEPh+0x10f)[0x55d12b19f8ff]
      /usr/sbin/mysqld(_Z13rr_sequentialP11READ_RECORD+0x1c)[0x55d12b2cde9c]
      /usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x1a9)[0x55d12afc7dd9]
      /usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xb9c)[0x55d12afea4cc]
      /usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x55d12afea723]
      /usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x186)[0x55d12afe8a26]
       
      /usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1d7)[0x55d12afe9597]
      /usr/sbin/mysqld(+0x58dd2a)[0x55d12ae83d2a]
      /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x4591)[0x55d12af90641]
      /usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x4b6)[0x55d12afa8d06]
      /usr/sbin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x92)[0x55d12afa8ec2]
      /usr/sbin/mysqld(+0x6b3827)[0x55d12afa9827]
      /usr/sbin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x27)[0x55d12afa98b7]
      /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1625)[0x55d12af97d85]
      /usr/sbin/mysqld(_Z10do_commandP3THD+0x11c)[0x55d12af99aac]
      /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1fa)[0x55d12b07718a]
      /usr/sbin/mysqld(handle_one_connection+0x3d)[0x55d12b07726d]
      pthread_create.c:0(start_thread)[0x7ff31532ae65]
      /lib64/libc.so.6(clone+0x6d)[0x7ff3136cb88d]
      

      I attach zip file with Table and Index description and two files with 'EXPLAIN EXTENDED', first where the query crashes and the second with a working query.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tpl@limitis Thomas Plant
              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.