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

SIGSEGV's in st_select_lex::mark_as_dependent and Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field on INSERT

    XMLWordPrintable

    Details

      Description

      Slightly sporadic. A whole set of different stacks across different versions dbg/opt are generated. Should be executed from CLI.

      SET sql_mode='';
      CREATE TABLE v0 (v0 FLOAT) ENGINE=InnoDB;
      INSERT INTO v0 SELECT * FROM (SELECT * FROM v0 ORDER BY v0,v0) AS v0 WHERE (v0 IN (SELECT v0 AND 0 * 0 GROUP BY v0,v0,v0));
      

      Leads to:

      10.10.0 63961a08a6203f4d58363a9321e4cf9c8b07a9fe (Optimized)

      Core was generated by `/test/MD290622-mariadb-10.10.0-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x000055fedf3e3cc3 in st_select_lex::mark_as_dependent (
          this=this@entry=0x14f7a4010f90, thd=thd@entry=0x14f7a4000c58, 
          last=last@entry=0x14f7a4010f90, dependency=0x14f7a404f538)
          at /test/10.10_opt/sql/sql_lex.h:1363
      1363	  st_select_lex_unit* master_unit() { return (st_select_lex_unit*) master; }
      [Current thread is 1 (Thread 0x14f81ce01700 (LWP 1089937))]
      (gdb) bt
      #0  0x000055fedf3e3cc3 in st_select_lex::mark_as_dependent (this=this@entry=0x14f7a4010f90, thd=thd@entry=0x14f7a4000c58, last=last@entry=0x14f7a4010f90, dependency=0x14f7a404f538) at /test/10.10_opt/sql/sql_lex.h:1363
      #1  0x000055fedf666b10 in mark_as_dependent (thd=0x14f7a4000c58, last=0x14f7a4010f90, current=0x14f7a4010f90, resolved_item=0x14f7a404f538, mark_item=<optimized out>, suppress_warning_output=<optimized out>) at /test/10.10_opt/sql/item.cc:5235
      #2  0x000055fedf679d86 in Item_field::fix_outer_field (this=0x14f7a404f538, thd=0x14f7a4000c58, from_field=0x14f81cdff460, reference=0x14f7a404f388) at /test/10.10_opt/sql/item.cc:5923
      #3  0x000055fedf67a9db in Item_field::fix_fields (this=0x14f7a404f538, thd=0x14f7a4000c58, reference=0x14f7a404f388) at /test/10.10_opt/sql/item.cc:6140
      #4  0x000055fedf6bdaad in Item::fix_fields_if_needed (ref=0x14f7a404f388, thd=0x14f7a4000c58, this=0x14f7a404f538) at /test/10.10_opt/sql/item.h:1142
      #5  Item::fix_fields_if_needed (ref=0x14f7a404f388, thd=0x14f7a4000c58, this=0x14f7a404f538) at /test/10.10_opt/sql/item.h:1142
      #6  Item_func::fix_fields (ref=<optimized out>, thd=0x14f7a4000c58, this=0x14f7a404f310) at /test/10.10_opt/sql/item_func.cc:347
      #7  Item_func::fix_fields (this=0x14f7a404f310, thd=0x14f7a4000c58, ref=<optimized out>) at /test/10.10_opt/sql/item_func.cc:314
      #8  0x000055fedf4828df in JOIN::optimize_inner (this=0x14f7a401e5a8) at /test/10.10_opt/sql/sql_select.cc:2201
      #9  0x000055fedf485d23 in JOIN::optimize (this=this@entry=0x14f7a401e5a8) at /test/10.10_opt/sql/sql_select.cc:1846
      #10 0x000055fedf3caebb in mysql_derived_optimize (thd=0x14f7a4000c58, lex=0x14f7a4004be0, derived=0x14f7a4012d90) at /test/10.10_opt/sql/sql_derived.cc:1064
      #11 0x000055fedf3ca708 in mysql_handle_single_derived (lex=0x14f7a4004be0, derived=derived@entry=0x14f7a4012d90, phases=phases@entry=4) at /test/10.10_opt/sql/sql_derived.cc:200
      #12 0x000055fedf482d7c in JOIN::optimize_inner (this=0x14f7a401ef20) at /test/10.10_opt/sql/sql_select.cc:2322
      #13 0x000055fedf485d23 in JOIN::optimize (this=this@entry=0x14f7a401ef20) at /test/10.10_opt/sql/sql_select.cc:1846
      #14 0x000055fedf485e0e in mysql_select (thd=0x14f7a4000c58, tables=0x14f7a4012d90, fields=@0x14f7a4011230: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f7a4011520, last = 0x14f7a4011520, elements = 1}, <No data fields>}, conds=0x14f7a40142b8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x14f7a401ee60, unit=0x14f7a4004cb8, select_lex=0x14f7a4010f90) at /test/10.10_opt/sql/sql_select.cc:5031
      #15 0x000055fedf4865a7 in handle_select (thd=thd@entry=0x14f7a4000c58, lex=lex@entry=0x14f7a4004be0, result=result@entry=0x14f7a401ee60, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.10_opt/sql/sql_select.cc:579
      #16 0x000055fedf4180ac in mysql_execute_command (thd=0x14f7a4000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.10_opt/sql/sql_parse.cc:4708
      #17 0x000055fedf404795 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x14f7a4000c58) at /test/10.10_opt/sql/sql_parse.cc:8036
      #18 mysql_parse (thd=0x14f7a4000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.10_opt/sql/sql_parse.cc:7958
      #19 0x000055fedf4102aa in dispatch_command (command=COM_QUERY, thd=0x14f7a4000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.10_opt/sql/sql_class.h:1364
      #20 0x000055fedf4121d2 in do_command (thd=0x14f7a4000c58, blocking=blocking@entry=true) at /test/10.10_opt/sql/sql_parse.cc:1407
      #21 0x000055fedf528ddf in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55fee297c068, put_in_cache=put_in_cache@entry=true) at /test/10.10_opt/sql/sql_connect.cc:1418
      #22 0x000055fedf5290bd in handle_one_connection (arg=0x55fee297c068) at /test/10.10_opt/sql/sql_connect.cc:1312
      #23 0x000014f847ec0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x000014f847aac133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.10.0 63961a08a6203f4d58363a9321e4cf9c8b07a9fe (Debug)

      mysqld: /test/10.10_dbg/sql/item.cc:5675: int Item_field::fix_outer_field(THD*, Field**, Item**): Assertion `outer_context || !*from_field || *from_field == not_found_field' failed.
      

      10.10.0 63961a08a6203f4d58363a9321e4cf9c8b07a9fe (Debug)

      Core was generated by `/test/MD290622-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      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 0x14addc0c4700 (LWP 1090587))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014adf483a859 in __GI_abort () at abort.c:79
      #2  0x000014adf483a729 in __assert_fail_base (fmt=0x14adf49d0588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x562e08cf5160 "outer_context || !*from_field || *from_field == not_found_field", file=0x562e08cf2980 "/test/10.10_dbg/sql/item.cc", line=5675, function=<optimized out>) at assert.c:92
      #3  0x000014adf484bfd6 in __GI___assert_fail (assertion=assertion@entry=0x562e08cf5160 "outer_context || !*from_field || *from_field == not_found_field", file=file@entry=0x562e08cf2980 "/test/10.10_dbg/sql/item.cc", line=line@entry=5675, function=function@entry=0x562e08cf51a0 "int Item_field::fix_outer_field(THD*, Field**, Item**)") at assert.c:101
      #4  0x0000562e0829814d in Item_field::fix_outer_field (this=this@entry=0x14ad3c076e08, thd=thd@entry=0x14ad3c000db8, from_field=from_field@entry=0x14addc0c2990, reference=reference@entry=0x14ad3c076c58) at /test/10.10_dbg/sql/item.cc:5675
      #5  0x0000562e0829987b in Item_field::fix_fields (this=0x14ad3c076e08, thd=0x14ad3c000db8, reference=0x14ad3c076c58) at /test/10.10_dbg/sql/item.cc:6140
      #6  0x0000562e082edb6e in Item::fix_fields_if_needed (ref=0x14ad3c076c58, thd=0x14ad3c000db8, this=<optimized out>) at /test/10.10_dbg/sql/item.h:1144
      #7  Item_func::fix_fields (this=0x14ad3c076be0, thd=0x14ad3c000db8, ref=<optimized out>) at /test/10.10_dbg/sql/item_func.cc:347
      #8  0x0000562e08008e75 in JOIN::optimize_inner (this=this@entry=0x14ad3c027688) at /test/10.10_dbg/sql/sql_select.cc:2201
      #9  0x0000562e08009e1a in JOIN::optimize (this=this@entry=0x14ad3c027688) at /test/10.10_dbg/sql/sql_select.cc:1846
      #10 0x0000562e07f2bf50 in mysql_derived_optimize (thd=0x14ad3c000db8, lex=0x14ad3c004f00, derived=0x14ad3c0162b0) at /test/10.10_dbg/sql/sql_derived.cc:1064
      #11 0x0000562e07f2b6f7 in mysql_handle_single_derived (lex=0x14ad3c004f00, derived=derived@entry=0x14ad3c0162b0, phases=phases@entry=4) at /test/10.10_dbg/sql/sql_derived.cc:200
      #12 0x0000562e08009bab in JOIN::optimize_inner (this=this@entry=0x14ad3c028000) at /test/10.10_dbg/sql/sql_select.cc:2322
      #13 0x0000562e08009e1a in JOIN::optimize (this=this@entry=0x14ad3c028000) at /test/10.10_dbg/sql/sql_select.cc:1846
      #14 0x0000562e08009f0d in mysql_select (thd=thd@entry=0x14ad3c000db8, tables=0x14ad3c0162b0, fields=@0x14ad3c014750: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ad3c014a40, last = 0x14ad3c014a40, elements = 1}, <No data fields>}, conds=0x14ad3c0177d8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202244745984, result=0x14ad3c027f40, unit=0x14ad3c004fd8, select_lex=0x14ad3c0144b0) at /test/10.10_dbg/sql/sql_select.cc:5031
      #15 0x0000562e0800a756 in handle_select (thd=thd@entry=0x14ad3c000db8, lex=lex@entry=0x14ad3c004f00, result=result@entry=0x14ad3c027f40, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.10_dbg/sql/sql_select.cc:579
      #16 0x0000562e07f844c7 in mysql_execute_command (thd=thd@entry=0x14ad3c000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:4708
      #17 0x0000562e07f70372 in mysql_parse (thd=thd@entry=0x14ad3c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14addc0c3470) at /test/10.10_dbg/sql/sql_parse.cc:8036
      #18 0x0000562e07f7d95a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14ad3c000db8, packet=packet@entry=0x14ad3c00b6c9 "INSERT INTO v0 SELECT * FROM (SELECT * FROM v0 ORDER BY v0,v0) AS v0 WHERE (v0 IN (SELECT v0 AND 0 * 0 GROUP BY v0,v0,v0))", packet_length=packet_length@entry=122, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
      #19 0x0000562e07f80064 in do_command (thd=0x14ad3c000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
      #20 0x0000562e080dffde in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562e0b51f6b8, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
      #21 0x0000562e080e04e7 in handle_one_connection (arg=0x562e0b51f6b8) at /test/10.10_dbg/sql/sql_connect.cc:1312
      #22 0x000014adf4d4b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #23 0x000014adf4937133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.26 (dbg), 10.4.26 (opt), 10.5.17 (dbg), 10.5.17 (opt), 10.6.9 (dbg), 10.6.9 (opt), 10.7.5 (dbg), 10.7.5 (opt), 10.8.4 (dbg), 10.8.4 (opt), 10.9.2 (dbg), 10.9.2 (opt), 10.10.0 (dbg), 10.10.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.36 (dbg), 10.3.36 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shulga Dmitry Shulga
              Reporter:
              Roel Roel Van de Paar
              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.