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

Assertion `!trx->read_only' failed in trx_undo_report_row_operation

Details

    Description

      DELIMITER //
      CREATE FUNCTION f() RETURNS INT BEGIN SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE,READ ONLY;RETURN 1;END;//
      DELIMITER ;
      CREATE TABLE t(c DECIMAL(0)) ENGINE=InnoDB;
      INSERT INTO t VALUES(f());
      

      Leads to:

      10.6.0 3f871b339429441ad907ecf7dfabdc414797e664 (Debug)

      mysqld: /data/builds/10.6_dbg/storage/innobase/trx/trx0rec.cc:2035: dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*): Assertion `!trx->read_only' failed.
      

      10.6.0 3f871b339429441ad907ecf7dfabdc414797e664 (Debug)

      Core was generated by `/test/MD260121-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x14f9241aa700 (LWP 3489967))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x000055bb76acb210 in my_write_core (sig=sig@entry=6) at /data/builds/10.6_dbg/mysys/stacktrace.c:424
      #2  0x000055bb762602d0 in handle_fatal_signal (sig=6) at /data/builds/10.6_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #5  0x000014f93b661859 in __GI_abort () at abort.c:79
      #6  0x000014f93b661729 in __assert_fail_base (fmt=0x14f93b7f7588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55bb76edc99e "!trx->read_only", file=0x55bb76edcc00 "/data/builds/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=2035, function=<optimized out>) at assert.c:92
      #7  0x000014f93b672f36 in __GI___assert_fail (assertion=assertion@entry=0x55bb76edc99e "!trx->read_only", file=file@entry=0x55bb76edcc00 "/data/builds/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=line@entry=2035, function=function@entry=0x55bb76edd780 "dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*)") at assert.c:101
      #8  0x000055bb7687bb2e in trx_undo_report_row_operation (thr=thr@entry=0x14f8ec0441a0, index=index@entry=0x14f8ec021fb8, clust_entry=clust_entry@entry=0x14f8ec093bd8, update=update@entry=0x0, cmpl_info=cmpl_info@entry=0, rec=rec@entry=0x0, offsets=0x0, roll_ptr=0x14f9241a70b0) at /data/builds/10.6_dbg/storage/innobase/trx/trx0rec.cc:2035
      #9  0x000055bb768d97bf in btr_cur_ins_lock_and_undo (flags=flags@entry=0, cursor=cursor@entry=0x14f9241a75c0, entry=entry@entry=0x14f8ec093bd8, thr=thr@entry=0x14f8ec0441a0, mtr=mtr@entry=0x14f9241a7b80, inherit=inherit@entry=0x14f9241a7197) at /data/builds/10.6_dbg/storage/innobase/btr/btr0cur.cc:3273
      #10 0x000055bb768e027a in btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x14f9241a75c0, offsets=offsets@entry=0x14f9241a7588, heap=heap@entry=0x14f9241a7580, entry=entry@entry=0x14f8ec093bd8, rec=rec@entry=0x14f9241a7598, big_rec=0x14f9241a7578, n_ext=<optimized out>, thr=0x14f8ec0441a0, mtr=0x14f9241a7b80) at /data/builds/10.6_dbg/storage/innobase/btr/btr0cur.cc:3500
      #11 0x000055bb767b7bca in row_ins_clust_index_entry_low (flags=flags@entry=0, mode=<optimized out>, mode@entry=2, index=index@entry=0x14f8ec021fb8, n_uniq=n_uniq@entry=0, entry=entry@entry=0x14f8ec093bd8, n_ext=n_ext@entry=0, thr=<optimized out>) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:2786
      #12 0x000055bb767b978e in row_ins_clust_index_entry (index=index@entry=0x14f8ec021fb8, entry=entry@entry=0x14f8ec093bd8, thr=thr@entry=0x14f8ec0441a0, n_ext=n_ext@entry=0) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:3258
      #13 0x000055bb767be344 in row_ins_index_entry (thr=0x14f8ec0441a0, entry=0x14f8ec093bd8, index=0x14f8ec021fb8) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:3383
      #14 row_ins_index_entry_step (thr=0x14f8ec0441a0, node=0x14f8ec043f70) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:3552
      #15 row_ins (thr=0x14f8ec0441a0, node=0x14f8ec043f70) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:3698
      #16 row_ins_step (thr=thr@entry=0x14f8ec0441a0) at /data/builds/10.6_dbg/storage/innobase/row/row0ins.cc:3840
      #17 0x000055bb767e2bef in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14f8ec0244f8 <incomplete sequence \375\200>, prebuilt=0x14f8ec043a78, ins_mode=ROW_INS_NORMAL) at /data/builds/10.6_dbg/storage/innobase/row/row0mysql.cc:1427
      #18 0x000055bb7666bd8a in ha_innobase::write_row (this=0x14f8ec043220, record=0x14f8ec0244f8 <incomplete sequence \375\200>) at /data/builds/10.6_dbg/storage/innobase/handler/ha_innodb.cc:7338
      #19 0x000055bb76274618 in handler::ha_write_row (this=0x14f8ec043220, buf=0x14f8ec0244f8 <incomplete sequence \375\200>) at /data/builds/10.6_dbg/sql/handler.cc:7151
      #20 0x000055bb75f4a4ad in write_record (thd=thd@entry=0x14f8ec000db8, table=table@entry=0x14f8ec024068, info=info@entry=0x14f9241a8c60, sink=sink@entry=0x0) at /data/builds/10.6_dbg/sql/sql_insert.cc:2106
      #21 0x000055bb75f56b4e in mysql_insert (thd=thd@entry=0x14f8ec000db8, table_list=0x14f8ec012798, fields=@0x14f8ec005e28: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55bb7756e2e0 <end_of_list>, last = 0x14f8ec005e28, elements = 0}, <No data fields>}, values_list=@0x14f8ec005e70: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f8ec014028, last = 0x14f8ec014028, elements = 1}, <No data fields>}, update_fields=@0x14f8ec005e58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55bb7756e2e0 <end_of_list>, last = 0x14f8ec005e58, elements = 0}, <No data fields>}, update_values=@0x14f8ec005e40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55bb7756e2e0 <end_of_list>, last = 0x14f8ec005e40, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /data/builds/10.6_dbg/sql/sql_insert.cc:1099
      #22 0x000055bb75f9d6a8 in mysql_execute_command (thd=thd@entry=0x14f8ec000db8) at /data/builds/10.6_dbg/sql/sql_parse.cc:4448
      #23 0x000055bb75f8815e in mysql_parse (thd=thd@entry=0x14f8ec000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f9241a93d0) at /data/builds/10.6_dbg/sql/sql_parse.cc:7901
      #24 0x000055bb75f9624f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f8ec000db8, packet=packet@entry=0x14f8ec01aac9 "INSERT INTO t VALUES(f())", packet_length=packet_length@entry=25) at /data/builds/10.6_dbg/sql/sql_class.h:1294
      #25 0x000055bb75f99581 in do_command (thd=0x14f8ec000db8) at /data/builds/10.6_dbg/sql/sql_parse.cc:1365
      #26 0x000055bb760f5079 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55bb7938ca68, put_in_cache=put_in_cache@entry=true) at /data/builds/10.6_dbg/sql/sql_connect.cc:1410
      #27 0x000055bb760f577d in handle_one_connection (arg=arg@entry=0x55bb7938ca68) at /data/builds/10.6_dbg/sql/sql_connect.cc:1312
      #28 0x000055bb765a843f in pfs_spawn_thread (arg=0x55bb792bfed8) at /data/builds/10.6_dbg/storage/perfschema/pfs.cc:2201
      #29 0x000014f93bb6f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #30 0x000014f93b75e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.2.37 (Optimized)

      Core was generated by `/test/MD260121-mariadb-10.2.37-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x145f880c1700 (LWP 3513389))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x00005560c8caf57f in my_write_core (sig=sig@entry=11) at /data/builds/10.2_opt/mysys/stacktrace.c:382
      #2  0x00005560c87568a8 in handle_fatal_signal (sig=11) at /data/builds/10.2_opt/sql/signal_handler.cc:343
      #3  <signal handler called>
      #4  0x00005560c8a28ccf in PolicyMutex<TTASEventMutex<GenericPolicy> >::enter (line=<optimized out>, name=<optimized out>, n_delay=<optimized out>, n_spins=<optimized out>, this=<optimized out>) at /data/builds/10.2_opt/storage/innobase/trx/trx0undo.cc:1597
      #5  trx_undo_assign_undo (trx=trx@entry=0x145f99165070, rseg=rseg@entry=0x0, undo=undo@entry=0x145f99166008, type=type@entry=1) at /data/builds/10.2_opt/storage/innobase/trx/trx0undo.cc:1597
      #6  0x00005560c8a0c797 in trx_undo_report_row_operation (thr=thr@entry=0x145f3c029be8, index=index@entry=0x145f3c01a868, clust_entry=clust_entry@entry=0x145f3c01a508, update=update@entry=0x0, cmpl_info=cmpl_info@entry=0, rec=rec@entry=0x0, offsets=0x0, roll_ptr=0x145f880bd120) at /data/builds/10.2_opt/storage/innobase/trx/trx0rec.cc:2067
      #7  0x00005560c8a4cd84 in btr_cur_ins_lock_and_undo (inherit=0x145f880bd108, mtr=0x145f880bdaf0, thr=0x145f3c029be8, entry=0x145f3c01a508, cursor=0x145f880bd3a0, flags=0) at /data/builds/10.2_opt/storage/innobase/btr/btr0cur.cc:3002
      #8  btr_cur_optimistic_insert (flags=0, cursor=cursor@entry=0x145f880bd3a0, offsets=offsets@entry=0x145f880bd388, heap=heap@entry=0x145f880bd380, entry=0x145f3c01a508, rec=rec@entry=0x145f880bd398, big_rec=0x145f880bd378, n_ext=<optimized out>, thr=0x145f3c029be8, mtr=0x145f880bdaf0) at /data/builds/10.2_opt/storage/innobase/btr/btr0cur.cc:3222
      #9  0x00005560c899b785 in row_ins_clust_index_entry_low (flags=<optimized out>, mode=<optimized out>, index=0x145f3c01a868, n_uniq=<optimized out>, entry=<optimized out>, n_ext=<optimized out>, thr=<optimized out>) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:2689
      #10 0x00005560c89a0f43 in row_ins_clust_index_entry (index=index@entry=0x145f3c01a868, entry=0x145f3c01a508, thr=thr@entry=0x145f3c029be8, n_ext=n_ext@entry=0) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:3141
      #11 0x00005560c89a1583 in row_ins_index_entry (thr=0x145f3c029be8, entry=<optimized out>, index=<optimized out>) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:3260
      #12 row_ins_index_entry_step (thr=0x145f3c029be8, node=<optimized out>) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:3411
      #13 row_ins (thr=0x145f3c01a868, node=<optimized out>) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:3548
      #14 row_ins_step (thr=thr@entry=0x145f3c029be8) at /data/builds/10.2_opt/storage/innobase/row/row0ins.cc:3668
      #15 0x00005560c89b21e0 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x145f3c016e48 <incomplete sequence \375\200>, prebuilt=0x145f3c0294d8) at /data/builds/10.2_opt/storage/innobase/row/row0mysql.cc:1411
      #16 0x00005560c890489a in ha_innobase::write_row (this=0x145f3c01d060, record=0x145f3c016e48 <incomplete sequence \375\200>) at /data/builds/10.2_opt/storage/innobase/handler/ha_innodb.cc:8164
      #17 0x00005560c876196f in handler::ha_write_row (this=0x145f3c01d060, buf=0x145f3c016e48 <incomplete sequence \375\200>) at /data/builds/10.2_opt/sql/handler.cc:6118
      #18 0x00005560c8587bfd in write_record (thd=thd@entry=0x145f3c000c48, table=table@entry=0x145f3c01c4c8, info=info@entry=0x145f880bec50) at /data/builds/10.2_opt/sql/sql_insert.cc:1939
      #19 0x00005560c8591bc8 in mysql_insert (thd=thd@entry=0x145f3c000c48, table_list=<optimized out>, fields=@0x145f3c0053b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5560c93bc5e0 <end_of_list>, last = 0x145f3c0053b0, elements = 0}, <No data fields>}, values_list=@0x145f3c0053f8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x145f3c010c78, last = 0x145f3c010c78, elements = 1}, <No data fields>}, update_fields=@0x145f3c0053e0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5560c93bc5e0 <end_of_list>, last = 0x145f3c0053e0, elements = 0}, <No data fields>}, update_values=@0x145f3c0053c8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5560c93bc5e0 <end_of_list>, last = 0x145f3c0053c8, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>) at /data/builds/10.2_opt/sql/sql_insert.cc:1066
      #20 0x00005560c85a6cf6 in mysql_execute_command (thd=0x145f3c000c48) at /data/builds/10.2_opt/sql/sql_parse.cc:4194
      #21 0x00005560c85ade5a in mysql_parse (thd=thd@entry=0x145f3c000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x145f880c0560, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/builds/10.2_opt/sql/sql_parse.cc:7763
      #22 0x00005560c85b101d in dispatch_command (command=COM_QUERY, thd=0x145f3c000c48, packet=0x145f3c006fa9 "INSERT INTO t VALUES(f())", packet_length=25, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/builds/10.2_opt/sql/sql_class.h:1096
      #23 0x00005560c85b2287 in do_command (thd=0x145f3c000c48) at /data/builds/10.2_opt/sql/sql_parse.cc:1381
      #24 0x00005560c868a676 in do_handle_one_connection (connect=connect@entry=0x5560cb25aa18) at /data/builds/10.2_opt/sql/sql_connect.cc:1336
      #25 0x00005560c868a7ef in handle_one_connection (arg=0x5560cb25aa18) at /data/builds/10.2_opt/sql/sql_connect.cc:1241
      #26 0x0000145fa1fc5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #27 0x0000145fa1bbc293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.3.28 75538f94ca06915ddc22458b82b8e148e51dd0db (Optimized)

      Core was generated by `/test/MD260121-mariadb-10.3.28-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x149ba418a700 (LWP 3512849))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x00005616518edbaf in my_write_core (sig=sig@entry=11) at /data/builds/10.3_opt/mysys/stacktrace.c:386
      #2  0x0000561651388968 in handle_fatal_signal (sig=11) at /data/builds/10.3_opt/sql/signal_handler.cc:343
      #3  <signal handler called>
      #4  0x000056165165ffef in PolicyMutex<TTASEventMutex<GenericPolicy> >::enter (line=<optimized out>, name=<optimized out>, n_delay=<optimized out>, n_spins=<optimized out>, this=<optimized out>) at /data/builds/10.3_opt/storage/innobase/include/buf0types.h:139
      #5  trx_undo_assign_low (trx=trx@entry=0x149ba79ff0c8, rseg=rseg@entry=0x0, undo=undo@entry=0x149ba7a00048, err=err@entry=0x149ba4184f1c, mtr=mtr@entry=0x149ba4184f70) at /data/builds/10.3_opt/storage/innobase/trx/trx0undo.cc:1467
      #6  0x000056165164566f in trx_undo_report_row_operation (thr=thr@entry=0x149b6002ab58, index=index@entry=0x149b6001bee8, clust_entry=clust_entry@entry=0x149b6001ac48, update=update@entry=0x0, cmpl_info=cmpl_info@entry=0, rec=rec@entry=0x0, offsets=0x0, roll_ptr=0x149ba4186120) at /data/builds/10.3_opt/storage/innobase/trx/trx0rec.cc:2009
      #7  0x000056165168703b in btr_cur_ins_lock_and_undo (inherit=0x149ba4186107, mtr=0x149ba4186b10, thr=0x149b6002ab58, entry=0x149b6001ac48, cursor=0x149ba41863c0, flags=<optimized out>) at /data/builds/10.3_opt/storage/innobase/btr/btr0cur.cc:3199
      #8  btr_cur_optimistic_insert (flags=<optimized out>, cursor=cursor@entry=0x149ba41863c0, offsets=offsets@entry=0x149ba41863a8, heap=heap@entry=0x149ba41863a0, entry=entry@entry=0x149b6001ac48, rec=rec@entry=0x149ba41863b8, big_rec=0x149ba4186398, n_ext=<optimized out>, thr=0x149b6002ab58, mtr=0x149ba4186b10) at /data/builds/10.3_opt/storage/innobase/btr/btr0cur.cc:3412
      #9  0x00005616515df829 in row_ins_clust_index_entry_low (flags=<optimized out>, mode=<optimized out>, index=0x149b6001bee8, n_uniq=<optimized out>, entry=0x149b6001ac48, n_ext=<optimized out>, thr=<optimized out>) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:2751
      #10 0x00005616515e0ccf in row_ins_clust_index_entry (index=index@entry=0x149b6001bee8, entry=0x149b6001ac48, thr=thr@entry=0x149b6002ab58, n_ext=n_ext@entry=0) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:3207
      #11 0x00005616515e1544 in row_ins_index_entry (thr=0x149b6002ab58, entry=<optimized out>, index=<optimized out>) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:3332
      #12 row_ins_index_entry_step (thr=0x149b6002ab58, node=<optimized out>) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:3483
      #13 row_ins (thr=0x149b6001bee8, node=<optimized out>) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:3642
      #14 row_ins_step (thr=thr@entry=0x149b6002ab58) at /data/builds/10.3_opt/storage/innobase/row/row0ins.cc:3788
      #15 0x00005616515f2e2e in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x149b600176a8 <incomplete sequence \375\200>, prebuilt=0x149b6002a458, ins_mode=ROW_INS_NORMAL) at /data/builds/10.3_opt/storage/innobase/row/row0mysql.cc:1421
      #16 0x000056165153c1d2 in ha_innobase::write_row (this=0x149b6001d2f0, record=0x149b600176a8 <incomplete sequence \375\200>) at /data/builds/10.3_opt/storage/innobase/handler/ha_innodb.cc:8009
      #17 0x000056165139499f in handler::ha_write_row (this=0x149b6001d2f0, buf=0x149b600176a8 <incomplete sequence \375\200>) at /data/builds/10.3_opt/sql/handler.cc:6473
      #18 0x000056165115b68d in write_record (thd=thd@entry=0x149b60000c48, table=table@entry=0x149b6001c718, info=info@entry=0x149ba4187ab0) at /data/builds/10.3_opt/sql/sql_insert.cc:2038
      #19 0x0000561651166075 in mysql_insert (thd=thd@entry=0x149b60000c48, table_list=<optimized out>, fields=@0x149b600056f8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5616520b5c40 <end_of_list>, last = 0x149b600056f8, elements = 0}, <No data fields>}, values_list=@0x149b60005740: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x149b60011148, last = 0x149b60011148, elements = 1}, <No data fields>}, update_fields=@0x149b60005728: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5616520b5c40 <end_of_list>, last = 0x149b60005728, elements = 0}, <No data fields>}, update_values=@0x149b60005710: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5616520b5c40 <end_of_list>, last = 0x149b60005710, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>) at /data/builds/10.3_opt/sql/sql_insert.cc:1072
      #20 0x000056165118d42c in mysql_execute_command (thd=0x149b60000c48) at /data/builds/10.3_opt/sql/sql_parse.cc:4481
      #21 0x0000561651194507 in mysql_parse (thd=0x149b60000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/builds/10.3_opt/sql/sql_parse.cc:7840
      #22 0x0000561651196885 in dispatch_command (command=COM_QUERY, thd=0x149b60000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/builds/10.3_opt/sql/sql_class.h:1139
      #23 0x000056165119889d in do_command (thd=0x149b60000c48) at /data/builds/10.3_opt/sql/sql_parse.cc:1398
      #24 0x000056165127fb36 in do_handle_one_connection (connect=connect@entry=0x561653a1b368) at /data/builds/10.3_opt/sql/sql_connect.cc:1403
      #25 0x000056165127fd0f in handle_one_connection (arg=0x561653a1b368) at /data/builds/10.3_opt/sql/sql_connect.cc:1308
      #26 0x0000149bbcd26609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #27 0x0000149bbc91d293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.37 (dbg), 10.2.37 (opt), 10.3.28 (dbg), 10.3.28 (opt), 10.4.18 (dbg), 10.4.18 (opt), 10.5.9 (dbg), 10.5.9 (opt), 10.6.0 (dbg), 10.6.0 (opt)
      MySQL: 5.6.51 (dbg), 5.6.51 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            Unique ID's seen in various versions (inc MS with the last entry: DICT_TF2_FLAG_IS_SET):

            !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_low|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo
            SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_undo|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo
            DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            

            Roel Roel Van de Paar added a comment - - edited Unique ID's seen in various versions (inc MS with the last entry: DICT_TF2_FLAG_IS_SET): !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_low|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_undo|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            Roel Roel Van de Paar added a comment - - edited

            MS 5.6.51 opt stack

            (Optimized)

            InnoDB: Failing assertion: DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)
            

            (Optimized)

            Core was generated by `/test/MS260121-mysql-5.6.51-linux-x86_64-opt/bin/mysqld --no-defaults --core --'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            [Current thread is 1 (Thread 0x14ebe5a81700 (LWP 3513020))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            #1  0x000055ee748167df in my_write_core (sig=sig@entry=6) at /data/builds/5.6_opt/mysys/stacktrace.c:436
            #2  0x000055ee745a367b in handle_fatal_signal (sig=6) at /data/builds/5.6_opt/sql/signal_handler.cc:237
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #5  0x000014ec0bf73859 in __GI_abort () at abort.c:79
            #6  0x000055ee744b7303 in trx_undo_report_row_operation (flags=flags@entry=0, op_type=op_type@entry=1, thr=thr@entry=0x14ebc00254e0, index=index@entry=0x14ebc0010948, clust_entry=clust_entry@entry=0x14ebc00112a8, update=update@entry=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x14ebe5a7e5f0) at /data/builds/5.6_opt/storage/innobase/trx/trx0rec.cc:1250
            #7  0x000055ee7493f58f in btr_cur_ins_lock_and_undo (inherit=0x14ebe5a7e5e8, mtr=0x14ebe5a7ea80, thr=0x14ebc00254e0, entry=0x14ebc00112a8, cursor=0x14ebe5a7e6e0, flags=0) at /data/builds/5.6_opt/storage/innobase/btr/btr0cur.cc:1178
            #8  btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x14ebe5a7e6e0, offsets=offsets@entry=0x14ebe5a7e6b0, heap=heap@entry=0x14ebe5a7e6c0, entry=entry@entry=0x14ebc00112a8, rec=rec@entry=0x14ebe5a7e6d8, big_rec=0x14ebe5a7e6b8, n_ext=<optimized out>, thr=0x14ebc00254e0, mtr=0x14ebe5a7ea80) at /data/builds/5.6_opt/storage/innobase/btr/btr0cur.cc:1400
            #9  0x000055ee748cd623 in row_ins_clust_index_entry_low (flags=<optimized out>, mode=2, index=0x14ebc0010948, n_uniq=<optimized out>, entry=<optimized out>, n_ext=<optimized out>, thr=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2478
            #10 0x000055ee748ce327 in row_ins_clust_index_entry (index=index@entry=0x14ebc0010948, entry=entry@entry=0x14ebc00112a8, thr=thr@entry=0x14ebc00254e0, n_ext=n_ext@entry=0) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2876
            #11 0x000055ee748ce8b8 in row_ins_index_entry (thr=0x14ebc00254e0, entry=<optimized out>, index=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2975
            #12 row_ins_index_entry_step (thr=<optimized out>, node=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3052
            #13 row_ins (thr=0x14ebc0010948, node=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3192
            #14 row_ins_step (thr=thr@entry=0x14ebc00254e0) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3317
            #15 0x000055ee748d86ea in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14ebc00137e8 <incomplete sequence \375\200>, prebuilt=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0mysql.cc:1372
            #16 0x000055ee74854244 in ha_innobase::write_row (this=0x14ebc0013520, record=0x14ebc00137e8 <incomplete sequence \375\200>) at /data/builds/5.6_opt/storage/innobase/handler/ha_innodb.cc:6824
            #17 0x000055ee744f3cb0 in handler::ha_write_row (this=0x14ebc0013520, buf=0x14ebc00137e8 <incomplete sequence \375\200>) at /data/builds/5.6_opt/sql/handler.cc:7373
            #18 0x000055ee7460870d in write_record (thd=thd@entry=0x55ee75ab1320, table=table@entry=0x14ebc0022bd0, info=info@entry=0x14ebe5a7f3c0, update=update@entry=0x14ebe5a7f440) at /data/builds/5.6_opt/sql/sql_insert.cc:1947
            #19 0x000055ee746104a9 in mysql_insert (thd=thd@entry=0x55ee75ab1320, table_list=<optimized out>, fields=@0x55ee75ab3d10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d10, elements = 0}, <No data fields>}, values_list=@0x55ee75ab3d58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ebc0002438, last = 0x14ebc0002438, elements = 1}, <No data fields>}, update_fields=@0x55ee75ab3d40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d40, elements = 0}, <No data fields>}, update_values=@0x55ee75ab3d28: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d28, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>) at /data/builds/5.6_opt/sql/sql_insert.cc:1079
            #20 0x000055ee746207ea in mysql_execute_command (thd=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_parse.cc:3525
            #21 0x000055ee746262e8 in mysql_parse (thd=thd@entry=0x55ee75ab1320, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ebe5a80660) at /data/builds/5.6_opt/sql/sql_parse.cc:6538
            #22 0x000055ee74628633 in dispatch_command (command=<optimized out>, thd=0x55ee75ab1320, packet=<optimized out>, packet_length=25) at /data/builds/5.6_opt/sql/sql_class.h:888
            #23 0x000055ee745f3df2 in do_handle_one_connection (thd_arg=thd_arg@entry=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_connect.cc:989
            #24 0x000055ee745f3eb2 in handle_one_connection (arg=arg@entry=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_connect.cc:906
            #25 0x000055ee74a4ad3f in pfs_spawn_thread (arg=0x55ee75afe620) at /data/builds/5.6_opt/storage/perfschema/pfs.cc:1868
            #26 0x000014ec0c494609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #27 0x000014ec0c070293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Roel Roel Van de Paar added a comment - - edited MS 5.6.51 opt stack (Optimized) InnoDB: Failing assertion: DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY) (Optimized) Core was generated by `/test/MS260121-mysql-5.6.51-linux-x86_64-opt/bin/mysqld --no-defaults --core --'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 [Current thread is 1 (Thread 0x14ebe5a81700 (LWP 3513020))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 #1 0x000055ee748167df in my_write_core (sig=sig@entry=6) at /data/builds/5.6_opt/mysys/stacktrace.c:436 #2 0x000055ee745a367b in handle_fatal_signal (sig=6) at /data/builds/5.6_opt/sql/signal_handler.cc:237 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #5 0x000014ec0bf73859 in __GI_abort () at abort.c:79 #6 0x000055ee744b7303 in trx_undo_report_row_operation (flags=flags@entry=0, op_type=op_type@entry=1, thr=thr@entry=0x14ebc00254e0, index=index@entry=0x14ebc0010948, clust_entry=clust_entry@entry=0x14ebc00112a8, update=update@entry=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x14ebe5a7e5f0) at /data/builds/5.6_opt/storage/innobase/trx/trx0rec.cc:1250 #7 0x000055ee7493f58f in btr_cur_ins_lock_and_undo (inherit=0x14ebe5a7e5e8, mtr=0x14ebe5a7ea80, thr=0x14ebc00254e0, entry=0x14ebc00112a8, cursor=0x14ebe5a7e6e0, flags=0) at /data/builds/5.6_opt/storage/innobase/btr/btr0cur.cc:1178 #8 btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x14ebe5a7e6e0, offsets=offsets@entry=0x14ebe5a7e6b0, heap=heap@entry=0x14ebe5a7e6c0, entry=entry@entry=0x14ebc00112a8, rec=rec@entry=0x14ebe5a7e6d8, big_rec=0x14ebe5a7e6b8, n_ext=<optimized out>, thr=0x14ebc00254e0, mtr=0x14ebe5a7ea80) at /data/builds/5.6_opt/storage/innobase/btr/btr0cur.cc:1400 #9 0x000055ee748cd623 in row_ins_clust_index_entry_low (flags=<optimized out>, mode=2, index=0x14ebc0010948, n_uniq=<optimized out>, entry=<optimized out>, n_ext=<optimized out>, thr=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2478 #10 0x000055ee748ce327 in row_ins_clust_index_entry (index=index@entry=0x14ebc0010948, entry=entry@entry=0x14ebc00112a8, thr=thr@entry=0x14ebc00254e0, n_ext=n_ext@entry=0) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2876 #11 0x000055ee748ce8b8 in row_ins_index_entry (thr=0x14ebc00254e0, entry=<optimized out>, index=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:2975 #12 row_ins_index_entry_step (thr=<optimized out>, node=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3052 #13 row_ins (thr=0x14ebc0010948, node=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3192 #14 row_ins_step (thr=thr@entry=0x14ebc00254e0) at /data/builds/5.6_opt/storage/innobase/row/row0ins.cc:3317 #15 0x000055ee748d86ea in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14ebc00137e8 <incomplete sequence \375\200>, prebuilt=<optimized out>) at /data/builds/5.6_opt/storage/innobase/row/row0mysql.cc:1372 #16 0x000055ee74854244 in ha_innobase::write_row (this=0x14ebc0013520, record=0x14ebc00137e8 <incomplete sequence \375\200>) at /data/builds/5.6_opt/storage/innobase/handler/ha_innodb.cc:6824 #17 0x000055ee744f3cb0 in handler::ha_write_row (this=0x14ebc0013520, buf=0x14ebc00137e8 <incomplete sequence \375\200>) at /data/builds/5.6_opt/sql/handler.cc:7373 #18 0x000055ee7460870d in write_record (thd=thd@entry=0x55ee75ab1320, table=table@entry=0x14ebc0022bd0, info=info@entry=0x14ebe5a7f3c0, update=update@entry=0x14ebe5a7f440) at /data/builds/5.6_opt/sql/sql_insert.cc:1947 #19 0x000055ee746104a9 in mysql_insert (thd=thd@entry=0x55ee75ab1320, table_list=<optimized out>, fields=@0x55ee75ab3d10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d10, elements = 0}, <No data fields>}, values_list=@0x55ee75ab3d58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ebc0002438, last = 0x14ebc0002438, elements = 1}, <No data fields>}, update_fields=@0x55ee75ab3d40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d40, elements = 0}, <No data fields>}, update_values=@0x55ee75ab3d28: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55ee74fe63c0 <end_of_list>, last = 0x55ee75ab3d28, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>) at /data/builds/5.6_opt/sql/sql_insert.cc:1079 #20 0x000055ee746207ea in mysql_execute_command (thd=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_parse.cc:3525 #21 0x000055ee746262e8 in mysql_parse (thd=thd@entry=0x55ee75ab1320, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ebe5a80660) at /data/builds/5.6_opt/sql/sql_parse.cc:6538 #22 0x000055ee74628633 in dispatch_command (command=<optimized out>, thd=0x55ee75ab1320, packet=<optimized out>, packet_length=25) at /data/builds/5.6_opt/sql/sql_class.h:888 #23 0x000055ee745f3df2 in do_handle_one_connection (thd_arg=thd_arg@entry=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_connect.cc:989 #24 0x000055ee745f3eb2 in handle_one_connection (arg=arg@entry=0x55ee75ab1320) at /data/builds/5.6_opt/sql/sql_connect.cc:906 #25 0x000055ee74a4ad3f in pfs_spawn_thread (arg=0x55ee75afe620) at /data/builds/5.6_opt/storage/perfschema/pfs.cc:1868 #26 0x000014ec0c494609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #27 0x000014ec0c070293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            Elkin Andrei Elkin added a comment -

            Roel, howdy! Seeing the stacks apprently unrelated to the description's --log_bin_trust_function_creators=1 ref, could you please confirm all the reported stacks indeed required the option?
            When not necessarily, then the owner must be Innodb. Thank you! Andrei.

            Elkin Andrei Elkin added a comment - Roel , howdy! Seeing the stacks apprently unrelated to the description's --log_bin_trust_function_creators=1 ref, could you please confirm all the reported stacks indeed required the option? When not necessarily, then the owner must be Innodb. Thank you! Andrei.

            source include/have_innodb.inc;
            DELIMITER |;
            CREATE FUNCTION f() RETURNS INT
            BEGIN
              SET SESSION TRANSACTION READ ONLY;RETURN 1;
            END;|
            DELIMITER ;|
            CREATE TABLE t(c DECIMAL(0)) ENGINE=InnoDB;
            INSERT INTO t VALUES(f());
            DROP TABLE t;
            

            With ./mtr --rr you can easily see that the transaction is being set to read-only mode in the middle of the insert (write_row(). An attempt to insert in a read-only transaction feels like API misuse. I do not think that it is feasible to fix this in InnoDB, because it could hurt performance. Instead, it should be fixed in this call stack, by throwing an error that the transaction has already been started:

            10.2 6b066ec33285c089ce770c2d1eb50bc49787ee92

            #0  0x0000563f860bf4e5 in Sys_var_tx_read_only::session_update (
                this=0x563f86fa2600 <Sys_tx_read_only>, thd=0x7fb274008eb8, 
                var=0x7fb27418bb10) at /mariadb/10.2o/sql/sys_vars.cc:3508
            #1  0x0000563f85f27000 in sys_var::update (
                this=0x563f86fa2600 <Sys_tx_read_only>, thd=0x7fb274008eb8, 
                var=0x7fb27418bb10) at /mariadb/10.2o/sql/set_var.cc:213
            #2  0x0000563f85f27545 in set_var::update (this=<optimized out>, 
                thd=<optimized out>) at /mariadb/10.2o/sql/set_var.cc:837
            #3  0x0000563f85f2861d in sql_set_variables (thd=thd@entry=0x7fb274008eb8, 
                var_list=var_list@entry=0x7fb274088700, free=free@entry=true)
                at /mariadb/10.2o/sql/set_var.cc:738
            #4  0x0000563f85fc0f41 in mysql_execute_command (thd=0x7fb274008eb8)
                at /mariadb/10.2o/sql/sql_parse.cc:4641
            #5  0x0000563f85f3d8ca in sp_instr_stmt::exec_core (this=0x7fb27418bb60, 
                thd=<optimized out>, nextp=0x7fb2640f1f84)
                at /mariadb/10.2o/sql/sp_head.cc:3337
            #6  0x0000563f85f45c63 in sp_lex_keeper::reset_lex_and_exec_core (
                this=this@entry=0x7fb27418bba0, thd=thd@entry=0x7fb274008eb8, 
                nextp=nextp@entry=0x7fb2640f1f84, open_tables=open_tables@entry=false, 
                instr=instr@entry=0x7fb27418bb60) at /mariadb/10.2o/sql/sp_head.cc:3099
            #7  0x0000563f85f4613f in sp_instr_stmt::execute (this=0x7fb27418bb60, 
                thd=0x7fb274008eb8, nextp=0x7fb2640f1f84)
                at /mariadb/10.2o/sql/sp_head.cc:3253
            #8  0x0000563f85f40ce6 in sp_head::execute (this=this@entry=0x7fb27418aae0, 
                thd=thd@entry=0x7fb274008eb8, 
                merge_da_on_success=merge_da_on_success@entry=true)
                at /mariadb/10.2o/sql/sp_head.cc:1326
            #9  0x0000563f85f41ff1 in sp_head::execute_function (this=0x7fb27418aae0, 
                thd=thd@entry=0x7fb274008eb8, argp=<optimized out>, argcount=0, 
                return_value_fld=<optimized out>) at /mariadb/10.2o/sql/sp_head.cc:1954
            #10 0x0000563f86221dd1 in Item_func_sp::execute_impl (
                this=this@entry=0x7fb27401a1e0, thd=thd@entry=0x7fb274008eb8)
                at /mariadb/10.2o/sql/item_func.cc:6752
            #11 0x0000563f86221e71 in Item_func_sp::execute (
                this=this@entry=0x7fb27401a1e0) at /mariadb/10.2o/sql/item_func.cc:6685
            #12 0x0000563f8623ba7b in Item_func_sp::val_int (this=0x7fb27401a1e0)
                at /mariadb/10.2o/sql/item_func.h:2412
            #13 0x0000563f861a1aca in Item::save_in_field (this=0x7fb27401a1e0, field=
                0x7fb2740850f8, no_conversions=<optimized out>)
                at /mariadb/10.2o/sql/item.cc:6496
            #14 0x0000563f85f7753e in fill_record (thd=thd@entry=0x7fb274008eb8, 
                table=table@entry=0x7fb27411b2b8, ptr=0x7fb2740850f0, 
                ptr@entry=0x7fb2740850e8, values=
                    @0x7fb274019fb0: {<base_list> = {<Sql_alloc> = {<No data fields>}, firs--Type <RET> for more, q to quit, c to continue without paging--
            t = 0x7fb27401b388, last = 0x7fb27401b388, elements = 1}, <No data fields>}, 
                ignore_errors=ignore_errors@entry=false, use_value=use_value@entry=false)
                at /mariadb/10.2o/sql/sql_base.cc:8368
            #15 0x0000563f85f7760d in fill_record_n_invoke_before_triggers (
                thd=thd@entry=0x7fb274008eb8, table=table@entry=0x7fb27411b2b8, 
                ptr=0x7fb2740850e8, values=
                    @0x7fb274019fb0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7fb27401b388, last = 0x7fb27401b388, elements = 1}, <No data fields>}, 
                ignore_errors=ignore_errors@entry=false, 
                event=event@entry=TRG_EVENT_INSERT) at /mariadb/10.2o/sql/sql_base.cc:8416
            #16 0x0000563f85fa7ae0 in mysql_insert (thd=thd@entry=0x7fb274008eb8, 
            

            marko Marko Mäkelä added a comment - source include/have_innodb.inc; DELIMITER |; CREATE FUNCTION f() RETURNS INT BEGIN SET SESSION TRANSACTION READ ONLY ; RETURN 1; END ;| DELIMITER ;| CREATE TABLE t(c DECIMAL (0)) ENGINE=InnoDB; INSERT INTO t VALUES (f()); DROP TABLE t; With ./mtr --rr you can easily see that the transaction is being set to read-only mode in the middle of the insert ( write_row() . An attempt to insert in a read-only transaction feels like API misuse. I do not think that it is feasible to fix this in InnoDB, because it could hurt performance. Instead, it should be fixed in this call stack, by throwing an error that the transaction has already been started: 10.2 6b066ec33285c089ce770c2d1eb50bc49787ee92 #0 0x0000563f860bf4e5 in Sys_var_tx_read_only::session_update ( this=0x563f86fa2600 <Sys_tx_read_only>, thd=0x7fb274008eb8, var=0x7fb27418bb10) at /mariadb/10.2o/sql/sys_vars.cc:3508 #1 0x0000563f85f27000 in sys_var::update ( this=0x563f86fa2600 <Sys_tx_read_only>, thd=0x7fb274008eb8, var=0x7fb27418bb10) at /mariadb/10.2o/sql/set_var.cc:213 #2 0x0000563f85f27545 in set_var::update (this=<optimized out>, thd=<optimized out>) at /mariadb/10.2o/sql/set_var.cc:837 #3 0x0000563f85f2861d in sql_set_variables (thd=thd@entry=0x7fb274008eb8, var_list=var_list@entry=0x7fb274088700, free=free@entry=true) at /mariadb/10.2o/sql/set_var.cc:738 #4 0x0000563f85fc0f41 in mysql_execute_command (thd=0x7fb274008eb8) at /mariadb/10.2o/sql/sql_parse.cc:4641 #5 0x0000563f85f3d8ca in sp_instr_stmt::exec_core (this=0x7fb27418bb60, thd=<optimized out>, nextp=0x7fb2640f1f84) at /mariadb/10.2o/sql/sp_head.cc:3337 #6 0x0000563f85f45c63 in sp_lex_keeper::reset_lex_and_exec_core ( this=this@entry=0x7fb27418bba0, thd=thd@entry=0x7fb274008eb8, nextp=nextp@entry=0x7fb2640f1f84, open_tables=open_tables@entry=false, instr=instr@entry=0x7fb27418bb60) at /mariadb/10.2o/sql/sp_head.cc:3099 #7 0x0000563f85f4613f in sp_instr_stmt::execute (this=0x7fb27418bb60, thd=0x7fb274008eb8, nextp=0x7fb2640f1f84) at /mariadb/10.2o/sql/sp_head.cc:3253 #8 0x0000563f85f40ce6 in sp_head::execute (this=this@entry=0x7fb27418aae0, thd=thd@entry=0x7fb274008eb8, merge_da_on_success=merge_da_on_success@entry=true) at /mariadb/10.2o/sql/sp_head.cc:1326 #9 0x0000563f85f41ff1 in sp_head::execute_function (this=0x7fb27418aae0, thd=thd@entry=0x7fb274008eb8, argp=<optimized out>, argcount=0, return_value_fld=<optimized out>) at /mariadb/10.2o/sql/sp_head.cc:1954 #10 0x0000563f86221dd1 in Item_func_sp::execute_impl ( this=this@entry=0x7fb27401a1e0, thd=thd@entry=0x7fb274008eb8) at /mariadb/10.2o/sql/item_func.cc:6752 #11 0x0000563f86221e71 in Item_func_sp::execute ( this=this@entry=0x7fb27401a1e0) at /mariadb/10.2o/sql/item_func.cc:6685 #12 0x0000563f8623ba7b in Item_func_sp::val_int (this=0x7fb27401a1e0) at /mariadb/10.2o/sql/item_func.h:2412 #13 0x0000563f861a1aca in Item::save_in_field (this=0x7fb27401a1e0, field= 0x7fb2740850f8, no_conversions=<optimized out>) at /mariadb/10.2o/sql/item.cc:6496 #14 0x0000563f85f7753e in fill_record (thd=thd@entry=0x7fb274008eb8, table=table@entry=0x7fb27411b2b8, ptr=0x7fb2740850f0, ptr@entry=0x7fb2740850e8, values= @0x7fb274019fb0: {<base_list> = {<Sql_alloc> = {<No data fields>}, firs--Type <RET> for more, q to quit, c to continue without paging-- t = 0x7fb27401b388, last = 0x7fb27401b388, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, use_value=use_value@entry=false) at /mariadb/10.2o/sql/sql_base.cc:8368 #15 0x0000563f85f7760d in fill_record_n_invoke_before_triggers ( thd=thd@entry=0x7fb274008eb8, table=table@entry=0x7fb27411b2b8, ptr=0x7fb2740850e8, values= @0x7fb274019fb0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7fb27401b388, last = 0x7fb27401b388, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /mariadb/10.2o/sql/sql_base.cc:8416 #16 0x0000563f85fa7ae0 in mysql_insert (thd=thd@entry=0x7fb274008eb8,

            sanja, I think that many instances of this class of bugs could be easily caught at compilation time by something like the following patch:

            diff --git a/sql/sql_base.h b/sql/sql_base.h
            index 56c6c82907a..e773ceb61b4 100644
            --- a/sql/sql_base.h
            +++ b/sql/sql_base.h
            @@ -158,11 +158,13 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
             void close_thread_tables(THD *thd);
             void switch_to_nullable_trigger_fields(List<Item> &items, TABLE *);
             void switch_defaults_to_nullable_trigger_fields(TABLE *table);
            +MY_ATTRITUTE((warn_unused_result))
             bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
                                                       List<Item> &fields,
                                                       List<Item> &values,
                                                       bool ignore_errors,
                                                       enum trg_event_type event);
            +MY_ATTRITUTE((warn_unused_result))
             bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
                                                       Field **field,
                                                       List<Item> &values,
            @@ -181,8 +183,10 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
                               List<Item> *sum_func_list, List<Item> *pre_fix,
                               bool allow_sum_func);
             void unfix_fields(List<Item> &items);
            +MY_ATTRITUTE((warn_unused_result))
             bool fill_record(THD * thd, TABLE *table_arg, List<Item> &fields,
                              List<Item> &values, bool ignore_errors, bool update);
            +MY_ATTRITUTE((warn_unused_result))
             bool fill_record(THD *thd, TABLE *table, Field **field, List<Item> &values,
                              bool ignore_errors, bool use_value);
             
            

            In the stack trace that I posted on 2021-12-13, we can see that fill_record_n_invoke_before_triggers() is properly propagating the return value of fill_record() to its caller, and also mysql_insert() might do the right thing. But we also see that select_insert::store_values() and select_create::store_values() are ignoring the errors, until that was fixed by MDEV-29540.

            marko Marko Mäkelä added a comment - sanja , I think that many instances of this class of bugs could be easily caught at compilation time by something like the following patch: diff --git a/sql/sql_base.h b/sql/sql_base.h index 56c6c82907a..e773ceb61b4 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -158,11 +158,13 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table, void close_thread_tables(THD *thd); void switch_to_nullable_trigger_fields(List<Item> &items, TABLE *); void switch_defaults_to_nullable_trigger_fields(TABLE *table); +MY_ATTRITUTE((warn_unused_result)) bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields, List<Item> &values, bool ignore_errors, enum trg_event_type event); +MY_ATTRITUTE((warn_unused_result)) bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **field, List<Item> &values, @@ -181,8 +183,10 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, List<Item> *sum_func_list, List<Item> *pre_fix, bool allow_sum_func); void unfix_fields(List<Item> &items); +MY_ATTRITUTE((warn_unused_result)) bool fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, bool ignore_errors, bool update); +MY_ATTRITUTE((warn_unused_result)) bool fill_record(THD *thd, TABLE *table, Field **field, List<Item> &values, bool ignore_errors, bool use_value); In the stack trace that I posted on 2021-12-13, we can see that fill_record_n_invoke_before_triggers() is properly propagating the return value of fill_record() to its caller, and also mysql_insert() might do the right thing. But we also see that select_insert::store_values() and select_create::store_values() are ignoring the errors, until that was fixed by MDEV-29540 .
            Roel Roel Van de Paar added a comment - - edited

            Retested against 10.5-11.7 and it exists in all versions, and in both build types dbg/opt. The variety of stacks (aborts + crashes) seen as of today (one per line) are:

            !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::pfs_begin_lock|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_low|trx_undo_report_row_operation
            SIGSEGV|srw_lock_impl<true>::wr_lock|trx_undo_assign_low<false>|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo
            

            Roel Roel Van de Paar added a comment - - edited Retested against 10.5-11.7 and it exists in all versions, and in both build types dbg/opt. The variety of stacks (aborts + crashes) seen as of today (one per line) are: !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low SIGSEGV|PolicyMutex<TTASEventMutex<GenericPolicy> >::pfs_begin_lock|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter|trx_undo_assign_low|trx_undo_report_row_operation SIGSEGV|srw_lock_impl<true>::wr_lock|trx_undo_assign_low<false>|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo

            Updated versions: Bug confirmed present in:
            MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (dbg), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.7.1 (dbg), 11.7.1 (opt), 11.8.0 (dbg), 11.8.0 (opt)
            MySQL: 5.6.51 (dbg), 5.6.51 (opt)

            Bug (or feature/syntax) confirmed not present in:
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.7.44 (dbg), 5.7.44 (opt), 8.0.36 (dbg), 8.0.36 (opt), 9.1.0 (dbg), 9.1.0 (opt)

            Accross versions:

            !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low
            SIGSEGV|std::__atomic_base<unsigned int>::compare_exchange_strong|TTASEventMutex<GenericPolicy>::try_lock|TTASEventMutex<GenericPolicy>::enter|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter
            SIGSEGV|std::__atomic_base<unsigned int>::compare_exchange_strong|srw_mutex_impl<true>::wr_lock_try|srw_mutex_impl<true>::wr_lock|ssux_lock_impl<true>::wr_lock
            

            Roel Roel Van de Paar added a comment - Updated versions: Bug confirmed present in: MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (dbg), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.7.1 (dbg), 11.7.1 (opt), 11.8.0 (dbg), 11.8.0 (opt) MySQL: 5.6.51 (dbg), 5.6.51 (opt) Bug (or feature/syntax) confirmed not present in: MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.7.44 (dbg), 5.7.44 (opt), 8.0.36 (dbg), 8.0.36 (opt), 9.1.0 (dbg), 9.1.0 (opt) Accross versions: !trx->read_only|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low DICT_TF2_FLAG_IS_SET(index->table, DICT_TF2_TEMPORARY)|SIGABRT|trx_undo_report_row_operation|btr_cur_ins_lock_and_undo|btr_cur_optimistic_insert|row_ins_clust_index_entry_low SIGSEGV|std::__atomic_base<unsigned int>::compare_exchange_strong|TTASEventMutex<GenericPolicy>::try_lock|TTASEventMutex<GenericPolicy>::enter|PolicyMutex<TTASEventMutex<GenericPolicy> >::enter SIGSEGV|std::__atomic_base<unsigned int>::compare_exchange_strong|srw_mutex_impl<true>::wr_lock_try|srw_mutex_impl<true>::wr_lock|ssux_lock_impl<true>::wr_lock

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.