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

ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table

    XMLWordPrintable

    Details

      Description

      Note: The failure looks similar to MDEV-19075, but the new one only happens on 10.5 starting from the commit mentioned below. Besides, test cases from MDEV-19075 don't seem to fail the same way anymore.

      SELECT 'foo' AS f UNION SELECT BINARY( UpdateXML('<a></a>', '/a', '<b></b>')) AS f;
      

      If the query is run on a server with default options, it causes ER_CRASHED_ON_USAGE:

      10.5 530f3f7c

      mysqltest: At line 1: query 'SELECT 'foo' AS f UNION SELECT BINARY( UpdateXML('<a></a>', '/a', '<b></b>')) AS f' failed: 1194: Table '(temporary)' is marked as crashed and should be repaired
      

      If it's run on a debug server with encryption for temporary tables, it causes an assertion failure:

      perl ./mtr bug.length1 --mysqld=--encrypt-tmp-disk-tables=1 --mysqld=--file-key-management-filename=`pwd`/std_data/keys.txt --mysqld=--plugin-load-add=file_key_management
      

      mysqld: /data/src/10.5/storage/maria/ma_blockrec.c:2806: write_block_record: Assertion `length <= column->length' failed.
      191012 20:57:47 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f0d94033f12 in __GI___assert_fail (assertion=0x562c4f3370fa "length <= column->length", file=0x562c4f3362a8 "/data/src/10.5/storage/maria/ma_blockrec.c", line=2806, function=0x562c4f338860 <__PRETTY_FUNCTION__.16428> "write_block_record") at assert.c:101
      #8  0x0000562c4ea0457f in write_block_record (info=0x7f0d7c094910, old_record=0x0, record=0x7f0d75fff0a0 "\375\003", row=0x7f0d7c094990, bitmap_blocks=0x7f0d7c094990, head_block_is_read=0 '\000', row_pos=0x7f0d8dff6fa0, undo_lsn=1, old_record_checksum=0) at /data/src/10.5/storage/maria/ma_blockrec.c:2806
      #9  0x0000562c4ea069e8 in allocate_and_write_block_record (info=0x7f0d7c094910, record=0x7f0d75fff0a0 "\375\003", row=0x7f0d7c094990, undo_lsn=1) at /data/src/10.5/storage/maria/ma_blockrec.c:3568
      #10 0x0000562c4ea06b01 in _ma_write_init_block_record (info=0x7f0d7c094910, record=0x7f0d75fff0a0 "\375\003") at /data/src/10.5/storage/maria/ma_blockrec.c:3608
      #11 0x0000562c4ea19bb0 in maria_write (info=0x7f0d7c094910, record=0x7f0d75fff0a0 "\375\003") at /data/src/10.5/storage/maria/ma_write.c:157
      #12 0x0000562c4e994ee9 in ha_maria::write_row (this=0x7f0d7c0d9388, buf=0x7f0d75fff0a0 "\375\003") at /data/src/10.5/storage/maria/ha_maria.cc:1243
      #13 0x0000562c4e480700 in handler::ha_write_tmp_row (this=0x7f0d7c0d9388, buf=0x7f0d75fff0a0 "\375\003") at /data/src/10.5/sql/sql_class.h:6749
      #14 0x0000562c4e462811 in create_internal_tmp_table_from_heap (thd=0x7f0d7c000b10, table=0x7f0d7c196028, start_recinfo=0x7f0d7c197488, recinfo=0x7f0d7c015410, error=135, ignore_last_dupp_key_error=true, is_duplicate=0x7f0d8dff861f) at /data/src/10.5/sql/sql_select.cc:19530
      #15 0x0000562c4e4f77ef in select_unit::write_record (this=0x7f0d7c015398) at /data/src/10.5/sql/sql_union.cc:424
      #16 0x0000562c4e4f6b19 in select_unit::send_data (this=0x7f0d7c015398, values=...) at /data/src/10.5/sql/sql_union.cc:162
      #17 0x0000562c4e437b2b in JOIN::exec_inner (this=0x7f0d7c015a58) at /data/src/10.5/sql/sql_select.cc:4262
      #18 0x0000562c4e4373d6 in JOIN::exec (this=0x7f0d7c015a58) at /data/src/10.5/sql/sql_select.cc:4176
      #19 0x0000562c4e4fdc24 in st_select_lex_unit::exec (this=0x7f0d7c004a40) at /data/src/10.5/sql/sql_union.cc:2199
      #20 0x0000562c4e4f6486 in mysql_union (thd=0x7f0d7c000b10, lex=0x7f0d7c004978, result=0x7f0d7c015370, unit=0x7f0d7c004a40, setup_tables_done_option=0) at /data/src/10.5/sql/sql_union.cc:41
      #21 0x0000562c4e428972 in handle_select (thd=0x7f0d7c000b10, lex=0x7f0d7c004978, result=0x7f0d7c015370, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:406
      #22 0x0000562c4e3ee6f6 in execute_sqlcom_select (thd=0x7f0d7c000b10, all_tables=0x0) at /data/src/10.5/sql/sql_parse.cc:6151
      #23 0x0000562c4e3e4bc3 in mysql_execute_command (thd=0x7f0d7c000b10) at /data/src/10.5/sql/sql_parse.cc:3900
      #24 0x0000562c4e3f33a1 in mysql_parse (thd=0x7f0d7c000b10, rawbuf=0x7f0d7c013580 "SELECT 'foo' AS f UNION SELECT BINARY( UpdateXML('<a></a>', '/a', '<b></b>')) AS f", length=82, parser_state=0x7f0d8dff9580, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7938
      #25 0x0000562c4e3de97f in dispatch_command (command=COM_QUERY, thd=0x7f0d7c000b10, packet=0x7f0d7c0083c1 "SELECT 'foo' AS f UNION SELECT BINARY( UpdateXML('<a></a>', '/a', '<b></b>')) AS f", packet_length=82, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1845
      #26 0x0000562c4e3dd0d9 in do_command (thd=0x7f0d7c000b10) at /data/src/10.5/sql/sql_parse.cc:1363
      #27 0x0000562c4e57b1ed in do_handle_one_connection (connect=0x562c516c4b20, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
      #28 0x0000562c4e57af1c in handle_one_connection (arg=0x562c516b3a00) at /data/src/10.5/sql/sql_connect.cc:1319
      #29 0x0000562c4eabf66b in pfs_spawn_thread (arg=0x562c515d7550) at /data/src/10.5/storage/perfschema/pfs.cc:1862
      #30 0x00007f0d95ba94a4 in start_thread (arg=0x7f0d8dffa700) at pthread_create.c:456
      #31 0x00007f0d940f0d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The failure started happening on 10.5 after this commit:

      commit b5fae7f743d2b2c71ee23b0daf51c2be294733eb
      Author: Alexander Barkov <bar@mariadb.com>
      Date:   Fri Oct 11 14:50:11 2019 +0400
       
          MDEV-20795 CAST(inet6 AS BINARY) returns wrong result
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: