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

Assertion `check_field_pointers(table)' fails in close_thread_tables upon update with SIMULTANEOUS_ASSIGNMENT

Details

    Description

      CREATE FUNCTION f() RETURNS BIGINT RETURN 0;
      SET SESSION SQL_MODE='SIMULTANEOUS_ASSIGNMENT';
      CREATE TABLE t (a INT, b INT);
      INSERT INTO t VALUES (1,2);
      UPDATE t SET a = 3, b = f();
       
      DROP TABLE t;
      DROP FUNCTION f;
      

      10.5 7f1492d0bc01fe24a55a3c5f9a9314b5c91d79d6

      mariadbd: /data/bld/10.5-asan/sql/sql_base.cc:830: int close_thread_tables(THD*): Assertion `check_field_pointers(table)' failed.
      250419  2:31:33 [ERROR] /share8t/bld/10.5-asan/sql/mariadbd got signal 6 ;
       
      #9  0x00007f6669853eb2 in __GI___assert_fail (assertion=0x55cf341ea580 "check_field_pointers(table)", file=0x55cf341e99e0 "/data/bld/10.5-asan/sql/sql_base.cc", line=830, function=0x55cf341ea4c0 "int close_thread_tables(THD*)") at ./assert/assert.c:101
      #10 0x000055cf31ed780c in close_thread_tables (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_base.cc:830
      #11 0x000055cf31e2b11f in sp_lex_keeper::reset_lex_and_exec_core (this=0x6250000f6938, thd=0x62b000069218, nextp=0x7f6660322270, open_tables=true, instr=0x6250000f68f0) at /data/bld/10.5-asan/sql/sp_head.cc:3583
      #12 0x000055cf31e2fcf2 in sp_instr_freturn::execute (this=0x6250000f68f0, thd=0x62b000069218, nextp=0x7f6660322270) at /data/bld/10.5-asan/sql/sp_head.cc:4237
      #13 0x000055cf31e1ccf4 in sp_head::execute (this=0x6250000f5138, thd=0x62b000069218, merge_da_on_success=true) at /data/bld/10.5-asan/sql/sp_head.cc:1443
      #14 0x000055cf31e215e0 in sp_head::execute_function (this=0x6250000f5138, thd=0x62b000069218, argp=0x62b000039978, argcount=2, return_value_fld=0x62b00003aab0, func_ctx=0x62b000039a08, call_arena=0x62b00003a3f0) at /data/bld/10.5-asan/sql/sp_head.cc:2201
      #15 0x000055cf3293ff20 in Item_sp::execute_impl (this=0x62b0000399a8, thd=0x62b000069218, args=0x62b000039978, arg_count=2) at /data/bld/10.5-asan/sql/item.cc:2968
      #16 0x000055cf3293f47f in Item_sp::execute (this=0x62b0000399a8, thd=0x62b000069218, null_value=0x62b00003995e, args=0x62b000039978, arg_count=2) at /data/bld/10.5-asan/sql/item.cc:2882
      #17 0x000055cf32a72a17 in Item_func_sp::execute (this=0x62b0000398e0) at /data/bld/10.5-asan/sql/item_func.cc:6719
      #18 0x000055cf32a84b7c in Item_func_sp::val_int (this=0x62b0000398e0) at /data/bld/10.5-asan/sql/item_func.h:3558
      #19 0x000055cf32961887 in Item::save_int_in_field (this=0x62b0000398e0, field=0x6190000a93f0, no_conversions=false) at /data/bld/10.5-asan/sql/item.cc:6978
      #20 0x000055cf3268d476 in Type_handler_int_result::Item_save_in_field (this=0x55cf367be320 <type_handler_slonglong>, item=0x62b0000398e0, field=0x6190000a93f0, no_conversions=false) at /data/bld/10.5-asan/sql/sql_type.cc:4368
      #21 0x000055cf32961a69 in Item::save_in_field (this=0x62b0000398e0, field=0x6190000a93f0, no_conversions=false) at /data/bld/10.5-asan/sql/item.cc:6988
      #22 0x000055cf31f04edb in fill_record (thd=0x62b000069218, table_arg=0x6190000a8c98, fields=..., values=..., ignore_errors=false, update=true) at /data/bld/10.5-asan/sql/sql_base.cc:8584
      #23 0x000055cf31f05ff7 in fill_record_n_invoke_before_triggers (thd=0x62b000069218, table=0x6190000a8c98, fields=..., values=..., ignore_errors=false, event=TRG_EVENT_UPDATE) at /data/bld/10.5-asan/sql/sql_base.cc:8751
      #24 0x000055cf3239fe31 in mysql_update (thd=0x62b000069218, table_list=0x62b000038438, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=true, found_return=0x7f6660324030, updated_return=0x7f6660324050) at /data/bld/10.5-asan/sql/sql_update.cc:1040
      #25 0x000055cf32087711 in mysql_execute_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:4507
      #26 0x000055cf320a11a3 in mysql_parse (thd=0x62b000069218, rawbuf=0x62b000038238 "UPDATE IGNORE test.tmp416 SET f1 = CONVERT((ADDTIME((TRIM(TRAILING FROM f1)), 7441916909253033984)) USING latin1), f3 = test.MIN2(f2, 65536)", length=140, parser_state=0x7f6660324c70, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:8243
      #27 0x000055cf320763b0 in dispatch_command (command=COM_QUERY, thd=0x62b000069218, packet=0x629000235219 "UPDATE IGNORE test.tmp416 SET f1 = CONVERT((ADDTIME((TRIM(TRAILING FROM f1)), 7441916909253033984)) USING latin1), f3 = test.MIN2(f2, 65536)", packet_length=140, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:1891
      #28 0x000055cf32072d43 in do_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:1375
      #29 0x000055cf324d0473 in do_handle_one_connection (connect=0x608000002f38, put_in_cache=true) at /data/bld/10.5-asan/sql/sql_connect.cc:1386
      #30 0x000055cf324cffd9 in handle_one_connection (arg=0x608000002eb8) at /data/bld/10.5-asan/sql/sql_connect.cc:1298
      #31 0x000055cf33131862 in pfs_spawn_thread (arg=0x615000006c18) at /data/bld/10.5-asan/storage/perfschema/pfs.cc:2201
      #32 0x00007f66698a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #33 0x00007f666992885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 10.5.28:

      commit e33064e0fcf991ec2d0535396a6061dad90c2a3e
      Author: Nikita Malyavin
      Date:   Thu Jan 16 01:44:06 2025 +0100
       
          MDEV-27769 Assertion failed in Field::ptr_in_record upon UPDATE in ORACLE mode
      

      however, since the commit added the assertion itself, it doesn't necessarily mean that it introduced the regression.
      There is no obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              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.