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

Assertion failure in file fts0que.cc causes database to crash

    XMLWordPrintable

Details

    Description

      the database crashes when a query is executed using a full text index which matches a lot of rows
      this is the query
      SELECT
      e.id AS id
      FROM
      event_log e
      WHERE
      (
      MATCH(single_line, username, event_name, data) AGAINST ('+ishay.com' IN BOOLEAN MODE)
      )
      ORDER BY
      e.created DESC,
      e.id DESC LIMIT 351;

      ishay.com matches 3027948 rows

      the problem doesn't happen if in the query I use a string which does not appear in the table

      I believe this is a bug in innodb fts and that percona have already fixed it in their release
      https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1634932

      when partitioning the table by timestamp (and including the timestamp in the query) the issue does NOT occur

      this is the output from the error log
      2022-07-18 09:01:24 0x7ff24413d700 InnoDB: Assertion failure in file /mnt/home/rpmstore-centos-seven/rpmstore/src/BUILD/mariadb-10.6.5/storage/innobase/fts/fts0que.cc line 3833
      InnoDB: Failing assertion: !query->intersection
      InnoDB: We intentionally generate a memory trap.
      InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
      InnoDB: If you get repeated assertion failures or crashes, even
      InnoDB: immediately after the mariadbd startup, there may be
      InnoDB: corruption in the InnoDB tablespace. Please refer to
      InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
      InnoDB: about forcing recovery.
      220718 9:01:24 [ERROR] mysqld got signal 6 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.

      To report this bug, see https://mariadb.com/kb/en/reporting-bugs

      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed,
      something is definitely wrong and this may fail.

      Server version: 10.6.5-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=28
      max_threads=502
      thread_count=30
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1236469 K bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.

      Thread pointer: 0x7ff1840009b8
      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 = 0x7ff24413ccc0 thread_stack 0x49000
      mysys/stacktrace.c:213(my_print_stacktrace)[0x56417d575e5e]
      sql/signal_handler.cc:226(handle_fatal_signal)[0x56417cf97ec7]
      sigaction.c:0(__restore_rt)[0x7ff54a062630]
      :0(__GI_raise)[0x7ff5480b43d7]
      :0(__GI_abort)[0x7ff5480b5ac8]
      :0(ut_dbg_assertion_failed(char const*, char const*, unsigned int))[0x56417cc52fe9]
      fts/fts0que.cc:3833(fts_query_free)[0x56417d4ce74b]
      handler/ha_innodb.cc:9640(ha_innobase::ft_init_ext(unsigned int, unsigned int, String*))[0x56417d2a3eed]
      sql/item_func.cc:6209(Item_func_match::init_search(THD*, bool))[0x56417d010588]
      sql/sql_base.cc:9048(init_ftfuncs(THD*, st_select_lex*, bool))[0x56417cd11e89]
      sql/sql_select.cc:3032(JOIN::optimize_stage2())[0x56417cdd2d28]
      sql/sql_select.cc:2479(JOIN::optimize_inner())[0x56417cdd5266]
      sql/sql_select.cc:1811(JOIN::optimize())[0x56417cdd7565]
      sql/sql_select.cc:4980(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*))[0x56417cdd7638]
      sql/sql_select.cc:557(handle_select(THD*, LEX*, select_result*, unsigned long))[0x56417cdd7f44]
      sql/sql_parse.cc:6257(execute_sqlcom_select(THD*, TABLE_LIST*))[0x56417cc3c4ad]
      sql/sql_parse.cc:3946(mysql_execute_command(THD*, bool))[0x56417cd7b774]
      sql/sql_parse.cc:8031(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x56417cd7daab]
      sql/sql_class.h:4336(THD::get_stmt_da())[0x56417cd7e2b9]
      sql/sql_parse.cc:1883(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x56417cd8083b]
      sql/sql_parse.cc:1406(do_command(THD*, bool))[0x56417cd81393]
      sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x56417ce75447]
      sql/sql_connect.cc:1316(handle_one_connection)[0x56417ce756e4]
      perfschema/pfs.cc:2204(pfs_spawn_thread)[0x56417d200c82]
      pthread_create.c:0(start_thread)[0x7ff54a05aea5]
      ??:0(__clone)[0x7ff54817c9fd]

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7ff1840106e0): SELECT
      e.id AS id
      FROM
      event_log e
      WHERE
      (
      MATCH(single_line, username, event_name, data) AGAINST ('+ishay.com' IN BOOLEAN MODE)
      )
      ORDER BY
      e.created DESC,
      e.id DESC LIMIT 351

      Connection ID (thread ID): 255
      Status: KILL_QUERY

      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off

      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /db/mysql
      Resource Limits:
      Limit Soft Limit Hard Limit Units
      Max cpu time unlimited unlimited seconds
      Max file size unlimited unlimited bytes
      Max data size unlimited unlimited bytes
      Max stack size 8388608 unlimited bytes
      Max core file size 0 unlimited bytes
      Max resident set unlimited unlimited bytes
      Max processes 125973 125973 processes
      Max open files 96000 96000 files
      Max locked memory 65536 65536 bytes
      Max address space unlimited unlimited bytes
      Max file locks unlimited unlimited locks
      Max pending signals 125973 125973 signals
      Max msgqueue size 819200 819200 bytes
      Max nice priority 0 0
      Max realtime priority 0 0
      Max realtime timeout unlimited unlimited us
      Core pattern: core

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ishay ishay wayner
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.