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

Assertion `item->null_value' failed in Type_handler::Item_send_str upon query with UUID()

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL)
    • 10.11, 11.4
    • Server
    • None

    Description

      CREATE TABLE t (a INT) ENGINE=MyISAM;
      INSERT INTO t VALUES (1);
       
      # We need a non-strict mode
      SET SQL_MODE= REPLACE(REPLACE(@@sql_mode,'STRICT_TRANS_TABLES',''),'STRICT_ALL_TABLES','');
       
      SELECT UUID(), COUNT(*) FROM t WHERE RAND(1);
       
      # Cleanup
      DROP TABLE t;
      

      bb-10.7-release 8bd21167d

      mariadbd: /data/src/bb-10.7-release/sql/sql_type.cc:7460: bool Type_handler::Item_send_str(Item*, Protocol*, st_value*) const: Assertion `item->null_value' failed.
      211108  1:39:53 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f71a2d33f36 in __GI___assert_fail (assertion=0x56130ce47b80 "item->null_value", file=0x56130ce41f80 "/data/src/bb-10.7-release/sql/sql_type.cc", line=7460, function=0x56130ce47b00 "bool Type_handler::Item_send_str(Item*, Protocol*, st_value*) const") at assert.c:101
      #8  0x000056130b19767a in Type_handler::Item_send_str (this=0x56130f7e6330 <FixedBinTypeBundle<UUID>::type_handler_fbt()::th>, item=0x6290000ea188, protocol=0x62b00007e870, buf=0x7f71998ac920) at /data/src/bb-10.7-release/sql/sql_type.cc:7460
      #9  0x000056130c9a4bb0 in FixedBinTypeBundle<UUID>::Type_handler_fbt::Item_send (this=0x56130f7e6330 <FixedBinTypeBundle<UUID>::type_handler_fbt()::th>, item=0x6290000ea188, p=0x62b00007e870, buf=0x7f71998ac920) at /data/src/bb-10.7-release/sql/sql_type_fixedbin.h:590
      #10 0x000056130a7ab03e in Item::send (this=0x6290000ea188, protocol=0x62b00007e870, buffer=0x7f71998ac920) at /data/src/bb-10.7-release/sql/item.h:1227
      #11 0x000056130a863195 in Protocol::send_result_set_row (this=0x62b00007e870, row_items=0x6290000e8110) at /data/src/bb-10.7-release/sql/protocol.cc:1324
      #12 0x000056130aa0bb9a in select_send::send_data (this=0x6290000e7ce8, items=...) at /data/src/bb-10.7-release/sql/sql_class.cc:3060
      #13 0x000056130ad25c25 in select_result_sink::send_data_with_check (this=0x6290000e7ce8, items=..., u=0x62b000082690, sent=0) at /data/src/bb-10.7-release/sql/sql_class.h:5605
      #14 0x000056130acd52f2 in do_select (join=0x6290000e7d18, procedure=0x0) at /data/src/bb-10.7-release/sql/sql_select.cc:20580
      #15 0x000056130ac61de1 in JOIN::exec_inner (this=0x6290000e7d18) at /data/src/bb-10.7-release/sql/sql_select.cc:4735
      #16 0x000056130ac5f2e6 in JOIN::exec (this=0x6290000e7d18) at /data/src/bb-10.7-release/sql/sql_select.cc:4513
      #17 0x000056130ac6384f in mysql_select (thd=0x62b00007e288, tables=0x6290000e6b30, fields=..., conds=0x6290000e7328, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x6290000e7ce8, unit=0x62b000082690, select_lex=0x6290000e6370) at /data/src/bb-10.7-release/sql/sql_select.cc:4993
      #18 0x000056130ac33d0b in handle_select (thd=0x62b00007e288, lex=0x62b0000825b8, result=0x6290000e7ce8, setup_tables_done_option=0) at /data/src/bb-10.7-release/sql/sql_select.cc:545
      #19 0x000056130ab5a884 in execute_sqlcom_select (thd=0x62b00007e288, all_tables=0x6290000e6b30) at /data/src/bb-10.7-release/sql/sql_parse.cc:6253
      #20 0x000056130ab4937b in mysql_execute_command (thd=0x62b00007e288, is_called_from_prepared_stmt=false) at /data/src/bb-10.7-release/sql/sql_parse.cc:3944
      #21 0x000056130ab65b23 in mysql_parse (thd=0x62b00007e288, rawbuf=0x6290000e62a8 "SELECT UUID(), COUNT(*) FROM t WHERE RAND(1)", length=44, parser_state=0x7f71998ae9a0) at /data/src/bb-10.7-release/sql/sql_parse.cc:8028
      #22 0x000056130ab3bc32 in dispatch_command (command=COM_QUERY, thd=0x62b00007e288, packet=0x62900025d289 "", packet_length=44, blocking=true) at /data/src/bb-10.7-release/sql/sql_parse.cc:1894
      #23 0x000056130ab38956 in do_command (thd=0x62b00007e288, blocking=true) at /data/src/bb-10.7-release/sql/sql_parse.cc:1402
      #24 0x000056130afd8f35 in do_handle_one_connection (connect=0x61100000a488, put_in_cache=true) at /data/src/bb-10.7-release/sql/sql_connect.cc:1418
      #25 0x000056130afd87c1 in handle_one_connection (arg=0x61100000a348) at /data/src/bb-10.7-release/sql/sql_connect.cc:1312
      #26 0x000056130bbcbd9f in pfs_spawn_thread (arg=0x618000005908) at /data/src/bb-10.7-release/storage/perfschema/pfs.cc:2201
      #27 0x00007f71a324c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007f71a2e1f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Also reproducible with a subquery like (SELECT 1) sq instead of the table.

      The failure appeared in 10.7 after this commit

      commit b1fab9bf4e8a0d807c1076b6610c7208f40ca0c1
      Author: Sergei Golubchik
      Date:   Tue Sep 14 12:08:01 2021 +0200
       
          UUID() function should return UUID, not VARCHAR(36)
      

      although possibly it just revealed a previously hidden issue. At least dependency on the non-strict mode existed before the patch above, although there was no assertion failure. I don't understand why the strict mode would affect this query, but it does.

      With strict mode:

      10.6

      UUID()	COUNT(*)
      NULL	0
      

      With non-strict mode:

      UUID()	COUNT(*)
      	0
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.