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

Server crashes in handler::update_global_table_stats or Assertion `inited == NONE || table->open_by_handler' in handler::ha_external_lock

    XMLWordPrintable

Details

    Description

      Note: Both failures have been very randomly observed in concurrent tests without changing MAX_SESSION_MEM_USED, it just allows to make a seemingly deterministic test case.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (f INT, row_start BIGINT UNSIGNED AS ROW START, row_end BIGINT UNSIGNED AS ROW END, PERIOD FOR SYSTEM_TIME(row_start,row_end)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 () VALUES ();
      FLUSH TABLES;
      UPDATE t1 SET f = NULL;
      SET MAX_SESSION_MEM_USED= @@max_session_mem_used + 1024;
      SELECT * FROM t1 FOR SYSTEM_TIME AS OF NOW();
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 non-debug f3f23b5c

      #3  <signal handler called>
      #4  0x0000562c903c013f in handler::update_global_table_stats (this=0x7fc69c0cd0f0) at /data/src/10.3/sql/handler.cc:4937
      #5  0x0000562c9017354d in close_thread_table (thd=thd@entry=0x7fc69c0009a8, table_ptr=table_ptr@entry=0x7fc69c000a88) at /data/src/10.3/sql/sql_base.cc:891
      #6  0x0000562c9017378b in close_thread_tables (thd=thd@entry=0x7fc69c0009a8) at /data/src/10.3/sql/sql_base.cc:862
      #7  0x0000562c901d0995 in mysql_execute_command (thd=thd@entry=0x7fc69c0009a8) at /data/src/10.3/sql/sql_parse.cc:6107
      #8  0x0000562c901d888a in mysql_parse (thd=thd@entry=0x7fc69c0009a8, rawbuf=<optimized out>, length=44, parser_state=parser_state@entry=0x7fc6e80b45f0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:7810
      #9  0x0000562c901da485 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fc69c0009a8, packet=packet@entry=0x7fc69c0070c9 "", packet_length=packet_length@entry=44, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1848
      #10 0x0000562c901dbf25 in do_command (thd=0x7fc69c0009a8) at /data/src/10.3/sql/sql_parse.cc:1393
      #11 0x0000562c902b0882 in do_handle_one_connection (connect=connect@entry=0x562c93a10e18) at /data/src/10.3/sql/sql_connect.cc:1403
      #12 0x0000562c902b09dd in handle_one_connection (arg=arg@entry=0x562c93a10e18) at /data/src/10.3/sql/sql_connect.cc:1308
      #13 0x0000562c908afbd1 in pfs_spawn_thread (arg=0x562c93a11078) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #14 0x00007fc6eef0d4a4 in start_thread (arg=0x7fc6e80b5700) at pthread_create.c:456
      #15 0x00007fc6edf8bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
       
      Query (0x7fc69c00f470): SELECT * FROM t1 FOR SYSTEM_TIME AS OF NOW()
      Connection ID (thread ID): 9
      Status: NOT_KILLED
      

      10.3 debug f3f23b5c

      mysqld: /data/src/10.3/sql/handler.cc:6364: int handler::ha_external_lock(THD*, int): Assertion `inited == NONE || table->open_by_handler' failed.
      200711  2:50:14 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f2f2a65cf12 in __GI___assert_fail (assertion=0x55e179455818 "inited == NONE || table->open_by_handler", file=0x55e179453796 "/data/src/10.3/sql/handler.cc", line=6364, function=0x55e1794576c0 <handler::ha_external_lock(THD*, int)::__PRETTY_FUNCTION__> "int handler::ha_external_lock(THD*, int)") at assert.c:101
      #8  0x000055e1789905ec in handler::ha_external_lock (this=0x7f2ed81811a8, thd=0x7f2ed8000af0, lock_type=2) at /data/src/10.3/sql/handler.cc:6364
      #9  0x000055e178ab8e24 in unlock_external (thd=0x7f2ed8000af0, table=0x7f2ed8013258, count=1) at /data/src/10.3/sql/lock.cc:708
      #10 0x000055e178ab8221 in mysql_unlock_tables (thd=0x7f2ed8000af0, sql_lock=0x7f2ed8013238, free_lock=false) at /data/src/10.3/sql/lock.cc:429
      #11 0x000055e178ab8178 in mysql_unlock_tables (thd=0x7f2ed8000af0, sql_lock=0x7f2ed8013238) at /data/src/10.3/sql/lock.cc:415
      #12 0x000055e1785ca473 in close_thread_tables (thd=0x7f2ed8000af0) at /data/src/10.3/sql/sql_base.cc:854
      #13 0x000055e1785ddbb0 in close_system_tables (thd=0x7f2ed8000af0, backup=0x7f2ed818ab80) at /data/src/10.3/sql/sql_base.cc:8933
      #14 0x000055e1785ddf3a in close_log_table (thd=0x7f2ed8000af0, backup=0x7f2ed818ab80) at /data/src/10.3/sql/sql_base.cc:9045
      #15 0x000055e178794887 in TR_table::~TR_table (this=0x7f2f242585b0, __in_chrg=<optimized out>) at /data/src/10.3/sql/table.cc:8931
      #16 0x000055e17887f012 in Item_func_trt_id::get_by_commit_ts (this=0x7f2ed8013a58, commit_ts=..., backwards=false) at /data/src/10.3/sql/item_vers.cc:120
      #17 0x000055e17887f22a in Item_func_trt_id::val_int (this=0x7f2ed8013a58) at /data/src/10.3/sql/item_vers.cc:153
      #18 0x000055e1785538d9 in Item::val_int_result (this=0x7f2ed8013a58) at /data/src/10.3/sql/item.h:1312
      #19 0x000055e1789b8381 in Item_cache_int::cache_value (this=0x7f2ed8015f58) at /data/src/10.3/sql/item.cc:9913
      #20 0x000055e1788722ea in Item_cache::has_value (this=0x7f2ed8015f58) at /data/src/10.3/sql/item.h:6221
      #21 0x000055e1789b8670 in Item_cache_int::val_int (this=0x7f2ed8015f58) at /data/src/10.3/sql/item.cc:9950
      #22 0x000055e17858c565 in Item::val_uint (this=0x7f2ed8015f58) at /data/src/10.3/sql/item.h:1072
      #23 0x000055e17887f4d7 in Item_func_trt_trx_sees::val_int (this=0x7f2ed8013be8) at /data/src/10.3/sql/item_vers.cc:173
      #24 0x000055e178863e93 in Type_handler_int_result::Item_val_bool (this=0x55e179d02950 <type_handler_long>, item=0x7f2ed8013be8) at /data/src/10.3/sql/sql_type.cc:3281
      #25 0x000055e1785537a6 in Item::val_bool (this=0x7f2ed8013be8) at /data/src/10.3/sql/item.h:1215
      #26 0x000055e1789d4d8c in Item_cond_and::val_int (this=0x7f2ed80161c8) at /data/src/10.3/sql/item_cmpfunc.cc:5072
      #27 0x000055e1786de6d6 in evaluate_join_record (join=0x7f2ed8013288, join_tab=0x7f2ed8015648, error=0) at /data/src/10.3/sql/sql_select.cc:19826
      #28 0x000055e1786de2d9 in sub_select (join=0x7f2ed8013288, join_tab=0x7f2ed8015648, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19731
      #29 0x000055e1786dd7bd in do_select (join=0x7f2ed8013288, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19271
      #30 0x000055e1786b458f in JOIN::exec_inner (this=0x7f2ed8013288) at /data/src/10.3/sql/sql_select.cc:4116
      #31 0x000055e1786b3962 in JOIN::exec (this=0x7f2ed8013288) at /data/src/10.3/sql/sql_select.cc:3910
      #32 0x000055e1786b4c73 in mysql_select (thd=0x7f2ed8000af0, tables=0x7f2ed8012b30, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2ed8013260, unit=0x7f2ed80049b8, select_lex=0x7f2ed8005140) at /data/src/10.3/sql/sql_select.cc:4315
      #33 0x000055e1786a624a in handle_select (thd=0x7f2ed8000af0, lex=0x7f2ed80048f8, result=0x7f2ed8013260, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
      #34 0x000055e17866db98 in execute_sqlcom_select (thd=0x7f2ed8000af0, all_tables=0x7f2ed8012b30) at /data/src/10.3/sql/sql_parse.cc:6286
      #35 0x000055e1786642eb in mysql_execute_command (thd=0x7f2ed8000af0) at /data/src/10.3/sql/sql_parse.cc:3812
      #36 0x000055e178671ea3 in mysql_parse (thd=0x7f2ed8000af0, rawbuf=0x7f2ed8012818 "SELECT * FROM t1 FOR SYSTEM_TIME AS OF NOW()", length=44, parser_state=0x7f2f2425a5e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7810
      #37 0x000055e17865e6ea in dispatch_command (command=COM_QUERY, thd=0x7f2ed8000af0, packet=0x7f2ed8165811 "", packet_length=44, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1848
      #38 0x000055e17865d002 in do_command (thd=0x7f2ed8000af0) at /data/src/10.3/sql/sql_parse.cc:1393
      #39 0x000055e1787d64d7 in do_handle_one_connection (connect=0x55e17b661290) at /data/src/10.3/sql/sql_connect.cc:1403
      #40 0x000055e1787d6239 in handle_one_connection (arg=0x55e17b661290) at /data/src/10.3/sql/sql_connect.cc:1308
      #41 0x000055e17918d0e8 in pfs_spawn_thread (arg=0x55e17b67c240) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #42 0x00007f2f2c5e54a4 in start_thread (arg=0x7f2f2425b700) at pthread_create.c:456
      #43 0x00007f2f2a719d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
       
      Query (0x7f2ed8012818): SELECT * FROM t1 FOR SYSTEM_TIME AS OF NOW()
      Connection ID (thread ID): 9
      Status: KILL_QUERY
      

      Reproducible on 10.3-10.5.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.