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

Assertion `marked_for_read()' failure in Item_func_conv_charset::Item_func_conv_charset

    XMLWordPrintable

Details

    Description

      _The assertion is similar to MDEV-31215 but the stack is different and the crash is reproduced on 10.5+ debug builds _

      SET character_set_connection=ucs2;
      CREATE TABLE t1 (d1 date not null, d2 date, gd text as (concat(d1,if(d1 <> d2, date_format(d2, 'to %y-%m-%d '), ''))) );
      --ERROR ER_NO_SUCH_TABLE
      SELECT (SELECT 1 FROM foo) FROM t1;
      INSERT INTO t1 (d1) VALUES ('2009-07-02');
      

      Leads to:

      11.5.0 374783c3d9a87170b313a05240dadaa813ec6034 (Debug)

      mariadbd: /test/11.5_dbg/sql/field.cc:6866: virtual String* Field_newdate::val_str(String*, String*): Assertion `marked_for_read()' failed.
      

      11.5.0 374783c3d9a87170b313a05240dadaa813ec6034 (Debug)

      Core was generated by `/test/MD210224-mariadb-11.5.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14d39c073700 (LWP 54683))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014d39ecd9859 in __GI_abort () at abort.c:79
      #2  0x000014d39ecd9729 in __assert_fail_base (fmt=0x14d39ee6f588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55aeb360b278 "marked_for_read()", file=0x55aeb360b0f3 "/test/11.5_dbg/sql/field.cc", line=6866, function=<optimized out>) at assert.c:92
      #3  0x000014d39eceafd6 in __GI___assert_fail (assertion=assertion@entry=0x55aeb360b278 "marked_for_read()", file=file@entry=0x55aeb360b0f3 "/test/11.5_dbg/sql/field.cc", line=line@entry=6866, function=function@entry=0x55aeb360cbb8 "virtual String* Field_newdate::val_str(String*, String*)") at assert.c:101
      #4  0x000055aeb2aaa0c8 in Field_newdate::val_str (this=0x14d34c034a88, val_buffer=0x14d39c070a60, val_ptr=<optimized out>) at /test/11.5_dbg/sql/field.cc:6866
      #5  0x000055aeb2af680a in Item_field::val_str (this=0x14d34c0356f8, str=0x14d39c070a60) at /test/11.5_dbg/sql/item.cc:3342
      #6  0x000055aeb2b00ee8 in Item_func_conv_charset::Item_func_conv_charset (cache_if_const=true, cs=0x55aeb3ec39a0 <my_charset_ucs2_general_ci>, a=0x14d34c0356f8, thd=0x14d34c000d48, this=0x14d34c036bd8) at /test/11.5_dbg/sql/sql_string.h:301
      #7  Item::safe_charset_converter (this=0x14d34c0356f8, thd=0x14d34c000d48, tocs=0x55aeb3ec39a0 <my_charset_ucs2_general_ci>) at /test/11.5_dbg/sql/item.cc:1285
      #8  0x000055aeb2b14ffe in Type_std_attributes::agg_item_set_converter (this=this@entry=0x14d34c036a28, coll=@0x14d34c036a30: {collation = 0x55aeb3ec39a0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, fname=@0x14d39c070b90: {str = 0x55aeb3629210 "concat", length = 6}, args=args@entry=0x14d34c036aa0, nargs=nargs@entry=2, flags=flags@entry=11, item_sep=1, single_err=0x0) at /test/11.5_dbg/sql/item.cc:2644
      #9  0x000055aeb2bbb257 in Type_std_attributes::agg_arg_charsets (item_sep=1, flags=11, nitems=2, items=0x14d34c036aa0, func_name=@0x14d39c070b90: {str = 0x55aeb3629210 "concat", length = 6}, c=@0x14d34c036a30: {collation = 0x55aeb3ec39a0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x14d34c036a28) at /test/11.5_dbg/sql/sql_type.h:3350
      #10 Type_std_attributes::agg_arg_charsets_for_string_result (item_sep=1, nitems=2, items=0x14d34c036aa0, func_name=@0x14d39c070b90: {str = 0x55aeb3629210 "concat", length = 6}, c=@0x14d34c036a30: {collation = 0x55aeb3ec39a0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x14d34c036a28) at /test/11.5_dbg/sql/sql_type.h:3365
      #11 Item_func_or_sum::agg_arg_charsets_for_string_result (item_sep=1, nitems=2, items=0x14d34c036aa0, c=@0x14d34c036a30: {collation = 0x55aeb3ec39a0 <my_charset_ucs2_general_ci>, derivation = DERIVATION_COERCIBLE, repertoire = MY_REPERTOIRE_ASCII}, this=0x14d34c036a20) at /test/11.5_dbg/sql/item.h:5427
      #12 Item_func_concat::fix_length_and_dec (this=0x14d34c036a20, thd=<optimized out>) at /test/11.5_dbg/sql/item_strfunc.cc:883
      #13 0x000055aeb2b6a4d7 in Item_func::fix_fields (this=this@entry=0x14d34c036a20, thd=thd@entry=0x14d34c000d48, ref=<optimized out>) at /test/11.5_dbg/sql/item_func.cc:377
      #14 0x000055aeb2bb50f4 in Item_str_func::fix_fields (this=0x14d34c036a20, thd=0x14d34c000d48, ref=<optimized out>) at /test/11.5_dbg/sql/item_strfunc.cc:132
      #15 0x000055aeb28de449 in Virtual_column_info::fix_expr (this=this@entry=0x14d34c036af0, thd=thd@entry=0x14d34c000d48) at /test/11.5_dbg/sql/table.cc:3733
      #16 0x000055aeb28de5c2 in Virtual_column_info::fix_session_expr (this=0x14d34c036af0, thd=thd@entry=0x14d34c000d48) at /test/11.5_dbg/sql/table.cc:3759
      #17 0x000055aeb28de8fc in TABLE::vcol_fix_expr (this=<optimized out>, thd=thd@entry=0x14d34c000d48) at /test/11.5_dbg/sql/table.cc:3843
      #18 0x000055aeb2725075 in open_table (thd=thd@entry=0x14d34c000d48, table_list=table_list@entry=0x14d34c018ef0, ot_ctx=ot_ctx@entry=0x14d39c071860) at /test/11.5_dbg/sql/sql_base.cc:2372
      #19 0x000055aeb2729da3 in open_and_process_table (ot_ctx=0x14d39c071860, has_prelocking_list=false, prelocking_strategy=0x14d39c071a50, flags=0, counter=0x14d39c0718fc, tables=0x14d34c018ef0, thd=0x14d34c000d48) at /test/11.5_dbg/sql/sql_base.cc:4168
      #20 open_tables (thd=thd@entry=0x14d34c000d48, options=@0x14d34c006758: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14d39c0718e8, counter=counter@entry=0x14d39c0718fc, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14d39c071a50) at /test/11.5_dbg/sql/sql_base.cc:4654
      #21 0x000055aeb272ad07 in open_and_lock_tables (thd=thd@entry=0x14d34c000d48, options=<optimized out>, tables=<optimized out>, tables@entry=0x14d34c018ef0, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14d39c071a50) at /test/11.5_dbg/sql/sql_base.cc:5628
      #22 0x000055aeb277096b in open_and_lock_tables (flags=0, derived=true, tables=0x14d34c018ef0, thd=0x14d34c000d48) at /test/11.5_dbg/sql/sql_base.h:528
      #23 mysql_insert (thd=thd@entry=0x14d34c000d48, table_list=0x14d34c018ef0, fields=@0x14d34c006110: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d34c019730, last = 0x14d34c019730, elements = 1}, <No data fields>}, values_list=@0x14d34c006158: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d34c019d60, last = 0x14d34c019d60, elements = 1}, <No data fields>}, update_fields=@0x14d34c006140: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55aeb3ef41e0 <end_of_list>, last = 0x14d34c006140, elements = 0}, <No data fields>}, update_values=@0x14d34c006128: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55aeb3ef41e0 <end_of_list>, last = 0x14d34c006128, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/11.5_dbg/sql/sql_insert.cc:772
      #24 0x000055aeb27b579a in mysql_execute_command (thd=thd@entry=0x14d34c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.5_dbg/sql/sql_parse.cc:4448
      #25 0x000055aeb27a1550 in mysql_parse (thd=thd@entry=0x14d34c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d39c0722b0) at /test/11.5_dbg/sql/sql_parse.cc:7815
      #26 0x000055aeb27af378 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d34c000d48, packet=packet@entry=0x14d34c00b1c9 "INSERT INTO t1 (d1) VALUES ('2009-07-02 01:02:03')", packet_length=packet_length@entry=50, blocking=blocking@entry=true) at /test/11.5_dbg/sql/sql_class.h:1563
      #27 0x000055aeb27b1c83 in do_command (thd=0x14d34c000d48, blocking=blocking@entry=true) at /test/11.5_dbg/sql/sql_parse.cc:1406
      #28 0x000055aeb292e583 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55aeb59c8b58, put_in_cache=put_in_cache@entry=true) at /test/11.5_dbg/sql/sql_connect.cc:1437
      #29 0x000055aeb292eb38 in handle_one_connection (arg=arg@entry=0x55aeb59c8b58) at /test/11.5_dbg/sql/sql_connect.cc:1339
      #30 0x000055aeb2da5ee6 in pfs_spawn_thread (arg=0x55aeb5949028) at /test/11.5_dbg/storage/perfschema/pfs.cc:2201
      #31 0x000014d39f1ea609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #32 0x000014d39edd6133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.33 (dbg), 10.5.24 (dbg), 10.6.17 (dbg), 10.11.7 (dbg), 11.0.5 (dbg), 11.1.4 (dbg), 11.2.4 (dbg), 11.3.2 (dbg), 11.4.0 (dbg), 11.5.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.4.33 (opt), 10.5.24 (opt), 10.6.17 (opt), 10.11.7 (opt), 11.0.5 (opt), 11.1.4 (opt), 11.2.4 (opt), 11.3.2 (opt), 11.4.0 (opt), 11.5.0 (opt)

      Attachments

        Activity

          People

            bar Alexander Barkov
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.