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

SIGSEGV in Item_func_nextval::update_table on SELECT SETVAL

    XMLWordPrintable

    Details

      Description

      Very similar to MDEV-23823 yet slightly different stack (Item_func_setval::val_int instead of Item_func_nextval::val_int). Issue is also less sporadic.

      CREATE VIEW t AS SELECT 1;
      LOCK TABLES t READ;
      SELECT SETVAL (t,0);
      

      Leads to:

      10.6.0 5d4599f9750140f92cfdbbe4d292ae1b8dd456f8 (Optimized)

      Core was generated by `/test/MD201020-mariadb-10.6.0-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 0x14ffe8c59700 (LWP 756318))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x000055ffe30d3a4f in my_write_core (sig=sig@entry=11) at /test/10.6_opt/mysys/stacktrace.c:424
      #2  0x000055ffe2af7130 in handle_fatal_signal (sig=11) at /test/10.6_opt/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  0x000055ffe2b5e423 in Item_func_nextval::update_table (this=0x14ffac010fb8, this=0x14ffac010fb8) at /test/10.6_opt/sql/item_func.h:3729
      #5  Item_func_setval::val_int (this=0x14ffac010fb8) at /test/10.6_opt/sql/item_func.cc:7155
      #6  0x000055ffe2a6022d in Type_handler::Item_send_longlong (this=<optimized out>, item=0x14ffac010fb8, protocol=0x14ffac001198, buf=<optimized out>) at /test/10.6_opt/sql/sql_type.cc:7385
      #7  0x000055ffe2827d60 in Protocol::send_result_set_row (this=this@entry=0x14ffac001198, row_items=row_items@entry=0x14ffac010580) at /test/10.6_opt/sql/protocol.cc:1080
      #8  0x000055ffe2898a67 in select_send::send_data (this=0x14ffac014858, items=@0x14ffac010580: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ffac0110a8, last = 0x14ffac0110a8, elements = 1}, <No data fields>}) at /test/10.6_opt/sql/sql_class.cc:3024
      #9  0x000055ffe2954fc6 in select_result_sink::send_data_with_check (u=<optimized out>, sent=0, items=<optimized out>, this=<optimized out>) at /test/10.6_opt/sql/sql_class.h:5309
      #10 select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.6_opt/sql/sql_class.h:5299
      #11 JOIN::exec_inner (this=0x14ffac014880) at /test/10.6_opt/sql/sql_select.cc:4333
      #12 0x000055ffe29552b9 in JOIN::exec (this=this@entry=0x14ffac014880) at /test/10.6_opt/sql/sql_select.cc:4246
      #13 0x000055ffe2953367 in mysql_select (thd=0x14ffac000c58, tables=0x0, fields=<optimized out>, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2149845760, result=0x14ffac014858, unit=0x14ffac004c20, select_lex=0x14ffac010430) at /test/10.6_opt/sql/sql_select.cc:4673
      #14 0x000055ffe2953d67 in handle_select (thd=thd@entry=0x14ffac000c58, lex=lex@entry=0x14ffac004b58, result=result@entry=0x14ffac014858, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_opt/sql/sql_select.cc:417
      #15 0x000055ffe28e3951 in execute_sqlcom_select (thd=0x14ffac000c58, all_tables=0x14ffac0108e0) at /test/10.6_opt/sql/sql_parse.cc:6062
      #16 0x000055ffe28f1380 in mysql_execute_command (thd=0x14ffac000c58) at /test/10.6_opt/sql/sql_parse.cc:3784
      #17 0x000055ffe28de03f in mysql_parse (thd=0x14ffac000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:7833
      #18 0x000055ffe28e9967 in dispatch_command (command=COM_QUERY, thd=0x14ffac000c58, packet=0x14ffac008009 "", packet_length=<optimized out>) at /test/10.6_opt/sql/sql_class.h:1253
      #19 0x000055ffe28ebd42 in do_command (thd=0x14ffac000c58) at /test/10.6_opt/sql/sql_parse.cc:1343
      #20 0x000055ffe29ef6e1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55ffe570ea18, put_in_cache=put_in_cache@entry=true) at /test/10.6_opt/sql/sql_connect.cc:1410
      #21 0x000055ffe29efb5d in handle_one_connection (arg=arg@entry=0x55ffe570ea18) at /test/10.6_opt/sql/sql_connect.cc:1312
      #22 0x000055ffe2d75266 in pfs_spawn_thread (arg=0x55ffe567ba28) at /test/10.6_opt/storage/perfschema/pfs.cc:2201
      #23 0x000014fffe015609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x000014fffdc04293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.6.0 5d4599f9750140f92cfdbbe4d292ae1b8dd456f8 (Debug)

      Core was generated by `/test/MD211020-mariadb-10.6.0-linux-x86_64-dbg/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 0x152955b68700 (LWP 846497))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x0000564cd3eb1021 in my_write_core (sig=sig@entry=11) at /test/10.6_dbg/mysys/stacktrace.c:424
      #2  0x0000564cd35f8321 in handle_fatal_signal (sig=11) at /test/10.6_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  0x0000564cd368fdee in Item_func_nextval::update_table (this=0x152928013288) at /test/10.6_dbg/sql/item_func.h:3729
      #5  Item_func_setval::val_int (this=0x152928013288) at /test/10.6_dbg/sql/item_func.cc:7155
      #6  0x0000564cd352ba29 in Type_handler::Item_send_longlong (this=<optimized out>, item=0x152928013288, protocol=0x152928001380, buf=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:7385
      #7  0x0000564cd3534b37 in Type_handler_longlong::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.6_dbg/sql/sql_type.h:5636
      #8  0x0000564cd322e31a in Item::send (this=0x152928013288, protocol=0x152928001380, buffer=0x152955b66310) at /test/10.6_dbg/sql/item.h:1060
      #9  0x0000564cd322b81c in Protocol::send_result_set_row (this=this@entry=0x152928001380, row_items=row_items@entry=0x152928012850) at /test/10.6_dbg/sql/protocol.cc:1080
      #10 0x0000564cd32c4efd in select_send::send_data (this=0x152928016b28, items=@0x152928012850: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152928013378, last = 0x152928013378, elements = 1}, <No data fields>}) at /test/10.6_dbg/sql/sql_class.cc:3024
      #11 0x0000564cd33b684c in select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.6_dbg/sql/sql_class.h:5309
      #12 JOIN::exec_inner (this=this@entry=0x152928016b50) at /test/10.6_dbg/sql/sql_select.cc:4333
      #13 0x0000564cd33b7733 in JOIN::exec (this=this@entry=0x152928016b50) at /test/10.6_dbg/sql/sql_select.cc:4246
      #14 0x0000564cd33b5944 in mysql_select (thd=thd@entry=0x152928000db8, tables=0x0, fields=@0x152928012850: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152928013378, last = 0x152928013378, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2149845760, result=0x152928016b28, unit=0x152928004f40, select_lex=0x152928012700) at /test/10.6_dbg/sql/sql_select.cc:4673
      #15 0x0000564cd33b5c72 in handle_select (thd=thd@entry=0x152928000db8, lex=lex@entry=0x152928004e78, result=result@entry=0x152928016b28, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:417
      #16 0x0000564cd332938e in execute_sqlcom_select (thd=thd@entry=0x152928000db8, all_tables=0x152928012bb0) at /test/10.6_dbg/sql/sql_parse.cc:6062
      #17 0x0000564cd3335aea in mysql_execute_command (thd=thd@entry=0x152928000db8) at /test/10.6_dbg/sql/sql_parse.cc:3784
      #18 0x0000564cd3321fd2 in mysql_parse (thd=thd@entry=0x152928000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x152955b673d0) at /test/10.6_dbg/sql/sql_parse.cc:7833
      #19 0x0000564cd33300c7 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152928000db8, packet=packet@entry=0x152928008ce9 "", packet_length=packet_length@entry=19) at /test/10.6_dbg/sql/sql_class.h:1253
      #20 0x0000564cd33333d2 in do_command (thd=0x152928000db8) at /test/10.6_dbg/sql/sql_parse.cc:1343
      #21 0x0000564cd348d994 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x564cd6180498, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #22 0x0000564cd348e09b in handle_one_connection (arg=arg@entry=0x564cd6180498) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #23 0x0000564cd3941abb in pfs_spawn_thread (arg=0x564cd60a80a8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #24 0x0000152978f0b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x0000152978afa293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.6.0 (opt), 10.6.0 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.48 (dbg), 10.1.48 (opt), 10.2.35 (dbg), 10.2.35 (opt), 10.3.26 (dbg), 10.3.26 (opt), 10.4.16 (dbg), 10.4.16 (opt), 10.5.7 (dbg), 10.5.7 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.50 (dbg), 5.6.50 (opt), 5.7.32 (dbg), 5.7.32 (opt), 8.0.22 (dbg), 8.0.22 (opt)

        Attachments

          Activity

            People

            Assignee:
            anel Anel Husakovic
            Reporter:
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: