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

Assertion `tab->ref.use_count' failed in join_read_key_unlock_row

    XMLWordPrintable

Details

    Description

      May be sporadic on 10.4 and potentially others.

      USE test;
      SET SQL_MODE='';
      CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=Aria;
      INSERT INTO t1 VALUES (0, 0),(1, 1);
      CREATE TABLE t2 SELECT * FROM t1;
      SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS c FROM t2;
      

      Leads to:

      10.5.6 1c587481966abc7a9ad5309d0a91ca920f7a5657 (Debug)

      mysqld: /test/10.5_dbg/sql/sql_select.cc:21335: void join_read_key_unlock_row(st_join_table*): Assertion `tab->ref.use_count' failed.
      

      10.5.6 1c587481966abc7a9ad5309d0a91ca920f7a5657 (Debug)

      Core was generated by `/test/MD110820-mariadb-10.5.6-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14b272e08700 (LWP 2084372))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055dd7c625b86 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:519
      #2  0x000055dd7bddcd7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014b27109e8b1 in __GI_abort () at abort.c:79
      #6  0x000014b27108e42a in __assert_fail_base (fmt=0x14b271215a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55dd7c7b60c9 "tab->ref.use_count", file=file@entry=0x55dd7c7b45e8 "/test/10.5_dbg/sql/sql_select.cc", line=line@entry=21335, function=function@entry=0x55dd7c7b3660 <join_read_key_unlock_row(st_join_table*)::__PRETTY_FUNCTION__> "void join_read_key_unlock_row(st_join_table*)") at assert.c:92
      #7  0x000014b27108e4a2 in __GI___assert_fail (assertion=assertion@entry=0x55dd7c7b60c9 "tab->ref.use_count", file=file@entry=0x55dd7c7b45e8 "/test/10.5_dbg/sql/sql_select.cc", line=line@entry=21335, function=function@entry=0x55dd7c7b3660 <join_read_key_unlock_row(st_join_table*)::__PRETTY_FUNCTION__> "void join_read_key_unlock_row(st_join_table*)") at assert.c:101
      #8  0x000055dd7bb6783d in join_read_key_unlock_row (tab=0x14b24e97a1f0) at /test/10.5_dbg/sql/sql_select.cc:21335
      #9  0x000055dd7bb6d821 in evaluate_join_record (join=join@entry=0x14b24e877b38, join_tab=join_tab@entry=0x14b24e97a1f0, error=error@entry=0) at /test/10.5_dbg/sql/sql_select.cc:20882
      #10 0x000055dd7bb74a1f in sub_select (join=0x14b24e877b38, join_tab=0x14b24e97a1f0, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20624
      #11 0x000055dd7bbaeb32 in do_select (procedure=0x0, join=0x14b24e877b38) at /test/10.5_dbg/sql/sql_select.cc:20158
      #12 JOIN::exec_inner (this=this@entry=0x14b24e877b38) at /test/10.5_dbg/sql/sql_select.cc:4450
      #13 0x000055dd7bbaf14d in JOIN::exec (this=0x14b24e877b38) at /test/10.5_dbg/sql/sql_select.cc:4231
      #14 0x000055dd7beca7c0 in subselect_single_select_engine::exec (this=0x14b24e876380) at /test/10.5_dbg/sql/item_subselect.cc:3989
      #15 0x000055dd7bec9b3b in Item_subselect::exec (this=0x14b24e8761d8) at /test/10.5_dbg/sql/item_subselect.cc:782
      #16 0x000055dd7bec803a in Item_singlerow_subselect::val_int (this=0x14b24e8761d8) at /test/10.5_dbg/sql/item_subselect.cc:1375
      #17 0x000055dd7ba4077b in Item::val_int_result (this=<optimized out>) at /test/10.5_dbg/sql/item.h:1566
      #18 0x000055dd7bdfc8e8 in Item_cache_int::cache_value (this=0x14b24e97b538) at /test/10.5_dbg/sql/item.cc:9811
      #19 0x000055dd7be2014f in Item_cache_wrapper::cache (this=this@entry=0x14b24e97b470) at /test/10.5_dbg/sql/item.cc:8649
      #20 0x000055dd7be12ebe in Item_cache_wrapper::val_int (this=0x14b24e97b470) at /test/10.5_dbg/sql/item.cc:8703
      #21 0x000055dd7bd18925 in Type_handler::Item_send_long (this=<optimized out>, item=0x14b24e97b470, protocol=0x14b24e815650, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:7330
      #22 0x000055dd7bd2010f in Type_handler_long::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.5_dbg/sql/sql_type.h:5494
      #23 0x000055dd7bdfc31f in Item::send (buffer=0x14b272e05f40, protocol=0x14b24e815650, this=0x14b24e97b470) at /test/10.5_dbg/sql/item.h:1060
      #24 Item_cache_wrapper::send (this=0x14b24e97b470, protocol=0x14b24e815650, buffer=0x14b272e05f40) at /test/10.5_dbg/sql/item.cc:8555
      #25 0x000055dd7ba3d65f in Protocol::send_result_set_row (this=this@entry=0x14b24e815650, row_items=row_items@entry=0x14b24e8742f0) at /test/10.5_dbg/sql/protocol.cc:1092
      #26 0x000055dd7bad059a in select_send::send_data (this=0x14b24e877488, items=@0x14b24e8742f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b24e8763c8, last = 0x14b24e8763c8, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/sql_class.cc:3018
      #27 0x000055dd7bb86a0f in select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=@0x14b24e8742f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b24e8763c8, last = 0x14b24e8763c8, elements = 1}, <No data fields>}, this=<optimized out>) at /test/10.5_dbg/sql/sql_class.h:5303
      #28 end_send (join=0x14b24e8774b0, join_tab=0x14b24e879298, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:21818
      #29 0x000055dd7bb6da10 in evaluate_join_record (join=join@entry=0x14b24e8774b0, join_tab=join_tab@entry=0x14b24e878ef0, error=error@entry=0) at /test/10.5_dbg/sql/sql_select.cc:20847
      #30 0x000055dd7bb74b40 in sub_select (join=0x14b24e8774b0, join_tab=0x14b24e878ef0, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20663
      #31 0x000055dd7bbaeb32 in do_select (procedure=0x0, join=0x14b24e8774b0) at /test/10.5_dbg/sql/sql_select.cc:20158
      #32 JOIN::exec_inner (this=this@entry=0x14b24e8774b0) at /test/10.5_dbg/sql/sql_select.cc:4450
      #33 0x000055dd7bbaf14d in JOIN::exec (this=this@entry=0x14b24e8774b0) at /test/10.5_dbg/sql/sql_select.cc:4231
      #34 0x000055dd7bbad449 in mysql_select (thd=thd@entry=0x14b24e815088, tables=<optimized out>, fields=@0x14b24e8742f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b24e8763c8, last = 0x14b24e8763c8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14b24e877488, unit=0x14b24e8190a0, select_lex=0x14b24e8741a0) at /test/10.5_dbg/sql/sql_select.cc:4655
      #35 0x000055dd7bbad778 in handle_select (thd=thd@entry=0x14b24e815088, lex=lex@entry=0x14b24e818fd8, result=result@entry=0x14b24e877488, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #36 0x000055dd7bb35d72 in execute_sqlcom_select (thd=thd@entry=0x14b24e815088, all_tables=0x14b24e876418) at /test/10.5_dbg/sql/sql_parse.cc:6210
      #37 0x000055dd7bb2ee46 in mysql_execute_command (thd=thd@entry=0x14b24e815088) at /test/10.5_dbg/sql/sql_parse.cc:3932
      #38 0x000055dd7bb3bd4e in mysql_parse (thd=thd@entry=0x14b24e815088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b272e07350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7994
      #39 0x000055dd7bb2877e in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b24e815088, packet=packet@entry=0x14b24e867089 "", packet_length=packet_length@entry=76, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1867
      #40 0x000055dd7bb26f58 in do_command (thd=0x14b24e815088) at /test/10.5_dbg/sql/sql_parse.cc:1348
      #41 0x000055dd7bc83bc9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14b251cd0808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
      #42 0x000055dd7bc842e5 in handle_one_connection (arg=arg@entry=0x14b251cd0808) at /test/10.5_dbg/sql/sql_connect.cc:1312
      #43 0x000055dd7c0ea572 in pfs_spawn_thread (arg=0x14b26fc46508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #44 0x000014b271d816db in start_thread (arg=0x14b272e08700) at pthread_create.c:463
      #45 0x000014b27117fa3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Attachments

        Issue Links

          Activity

            People

              varun Varun Gupta (Inactive)
              Roel Roel Van de Paar
              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.