Details

    Description

      The following example causes a crash:

      create or replace database crashTest;
      use crashTest;
      

      create or replace table location (
      location_code varchar(10),
      country_id varchar(10)
      );
      insert into location values ('HKG', 'HK');
      insert into location values ('NYC', 'US');
      insert into location values ('LAX', 'US');
      

      create or replace table cntr_leg (
      container_id varchar(10),
      cntr_activity_type varchar(10),
      cntr_dest varchar(10)
      );
      insert into cntr_leg values ('AAAA1111', 'VSL', 'NYC');
      insert into cntr_leg values ('AAAA1111', 'CUV', 'NYC');
      insert into cntr_leg values ('BBBB2222', 'VSL', 'LAX');
      insert into cntr_leg values ('BBBB2222', 'XYZ', 'LAX');
      

      select
        (select country_id from location where location_code = cl1.cntr_dest) as dest_cntry,
        (select 
           max(container_id) 
         from cntr_leg as cl2 
         where
          cl2.container_id = cl1.container_id and
          cl2.cntr_activity_type = 'CUV' and
          exists (select location_code 
                  from location 
                  where 
                     location_code = cl2.cntr_dest and 
                     country_id = dest_cntry)
         ) as CUV
      from
        cntr_leg cl1;
      

      Crashes as follows:

        [New Thread 0x7fffd979a700 (LWP 3851)]
        mysqld: /home/psergey/dev-git/10.4-cl2/sql/item_subselect.cc:953: virtual bool Item_subselect::const_item() const: Assertion `thd' failed.
        
        Thread 34 "mysqld" received signal SIGABRT, Aborted.
        [Switching to Thread 0x7fffd979a700 (LWP 3851)]
        __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
        51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
      (gdb) wher
        #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
        #1  0x00007ffff52258b1 in __GI_abort () at abort.c:79
        #2  0x00007ffff521542a in __assert_fail_base (fmt=0x7ffff539ca38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x555556c0b3d6 "thd", file=file@entry=0x555556c0b0a0 "/home/psergey/dev-git/10.4-cl2/sql/item_subselect.cc", line=line@entry=953, function=function@entry=0x555556c0cf80 <Item_subselect::const_item() const::__PRETTY_FUNCTION__> "virtual bool Item_subselect::const_item() const") at assert.c:92
        #3  0x00007ffff52154a2 in __GI___assert_fail (assertion=0x555556c0b3d6 "thd", file=0x555556c0b0a0 "/home/psergey/dev-git/10.4-cl2/sql/item_subselect.cc", line=953, function=0x555556c0cf80 <Item_subselect::const_item() const::__PRETTY_FUNCTION__> "virtual bool Item_subselect::const_item() const") at assert.c:101
        #4  0x00005555561a43bc in Item_subselect::const_item (this=0x7fff680c44e8) at /home/psergey/dev-git/10.4-cl2/sql/item_subselect.cc:953
        #5  0x00005555561b836a in Item_in_subselect::const_item (this=0x7fff680c44e8) at /home/psergey/dev-git/10.4-cl2/sql/item_subselect.h:642
        #6  0x0000555555cdc65c in Used_tables_and_const_cache::used_tables_and_const_cache_join (this=0x7fff680bce78, item=0x7fff680c44e8) at /home/psergey/dev-git/10.4-cl2/sql/item.h:5020
        #7  0x0000555555cdc6ba in Used_tables_and_const_cache::used_tables_and_const_cache_update_and_join (this=0x7fff680bce78, item=0x7fff680c44e8) at /home/psergey/dev-git/10.4-cl2/sql/item.h:5025
        #8  0x0000555555cdc704 in Used_tables_and_const_cache::used_tables_and_const_cache_update_and_join (this=0x7fff680bce78, argc=2, argv=0x7fff680bce60) at /home/psergey/dev-git/10.4-cl2/sql/item.h:5036
        #9  0x0000555555cddcb8 in Item_func::update_used_tables (this=0x7fff680bcdd0) at /home/psergey/dev-git/10.4-cl2/sql/item_func.h:160
        #10 0x0000555555cdc6a7 in Used_tables_and_const_cache::used_tables_and_const_cache_update_and_join (this=0x7fff68015c00, item=0x7fff680bcdd0) at /home/psergey/dev-git/10.4-cl2/sql/item.h:5024
        #11 0x0000555556124b75 in Used_tables_and_const_cache::used_tables_and_const_cache_update_and_join (this=0x7fff68015c00, list=...) at /home/psergey/dev-git/10.4-cl2/sql/item.h:5049
        #12 0x0000555556129390 in Item_cond::update_used_tables (this=0x7fff68015b58) at /home/psergey/dev-git/10.4-cl2/sql/item_cmpfunc.h:2993
        #13 0x0000555555d3be12 in st_select_lex::update_used_tables (this=0x7fff68014488) at /home/psergey/dev-git/10.4-cl2/sql/sql_lex.cc:4598
        #14 0x0000555555d3b150 in st_select_lex::optimize_unflattened_subqueries (this=0x7fff680124d8, const_only=false) at /home/psergey/dev-git/10.4-cl2/sql/sql_lex.cc:4202
        #15 0x0000555555f5a444 in JOIN::optimize_unflattened_subqueries (this=0x7fff680ba858) at /home/psergey/dev-git/10.4-cl2/sql/opt_subselect.cc:5520
        #16 0x0000555555db99db in JOIN::optimize_stage2 (this=0x7fff680ba858) at /home/psergey/dev-git/10.4-cl2/sql/sql_select.cc:2833
        #17 0x0000555555db7956 in JOIN::optimize_inner (this=0x7fff680ba858) at /home/psergey/dev-git/10.4-cl2/sql/sql_select.cc:2289
        #18 0x0000555555db51a2 in JOIN::optimize (this=0x7fff680ba858) at /home/psergey/dev-git/10.4-cl2/sql/sql_select.cc:1610
        #19 0x0000555555dc064a in mysql_select (thd=0x7fff68000d50, tables=0x7fff680b99a0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff68018100, unit=0x7fff68004c78, select_lex=0x7fff680124d8) at /home/psergey/dev-git/10.4-cl2/sql/sql_select.cc:4673
        #20 0x0000555555db01b5 in handle_select (thd=0x7fff68000d50, lex=0x7fff68004bb8, result=0x7fff68018100, setup_tables_done_option=0) at /home/psergey/dev-git/10.4-cl2/sql/sql_select.cc:410
        #21 0x0000555555d76ae1 in execute_sqlcom_select (thd=0x7fff68000d50, all_tables=0x7fff680b99a0) at /home/psergey/dev-git/10.4-cl2/sql/sql_parse.cc:6358
        #22 0x0000555555d6d10c in mysql_execute_command (thd=0x7fff68000d50) at /home/psergey/dev-git/10.4-cl2/sql/sql_parse.cc:3890
        #23 0x0000555555d7aa7f in mysql_parse (thd=0x7fff68000d50, rawbuf=0x7fff680121a8 "select\n(select country_id from location where location_code = cl1.cntr_dest) as dest_cntry,\n\n(select max(container_id) from cntr_leg as cl2 where\ncl2.container_id = cl1.container_id and\ncl2.cntr_activ"..., length=353, parser_state=0x7fffd9799550, is_com_multi=false, is_next_command=false) at /home/psergey/dev-git/10.4-cl2/sql/sql_parse.cc:7899
      

      Stack trace from the original report :

      Server version: 10.4.11-MariaDB
      ...
      Thread pointer: 0xb4fd85a738
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      mysqld.exe!Item_subselect::const_item()[item_subselect.cc:954]
      mysqld.exe!Item_in_subselect::const_item()[item_subselect.h:642]
      mysqld.exe!Used_tables_and_const_cache::used_tables_and_const_cache_update_and_join()[item.h:4982]
      mysqld.exe!Item_cond::update_used_tables()[item_cmpfunc.h:2992]
      mysqld.exe!st_select_lex::update_used_tables()[sql_lex.cc:4586]
      mysqld.exe!st_select_lex::optimize_unflattened_subqueries()[sql_lex.cc:4190]
      mysqld.exe!JOIN::optimize_stage2()[sql_select.cc:2810]
      mysqld.exe!JOIN::optimize_inner()[sql_select.cc:2274]
      mysqld.exe!JOIN::optimize()[sql_select.cc:1600]
      mysqld.exe!mysql_select()[sql_select.cc:4646]
      mysqld.exe!handle_select()[sql_select.cc:408]
      mysqld.exe!execute_sqlcom_select()[sql_parse.cc:6360]
      mysqld.exe!mysql_execute_command()[sql_parse.cc:3899]
      mysqld.exe!mysql_parse()[sql_parse.cc:7906]
      mysqld.exe!dispatch_command()[sql_parse.cc:1844]
      mysqld.exe!do_command()[sql_parse.cc:1359]
      mysqld.exe!threadpool_process_request()[threadpool_common.cc:366]
      mysqld.exe!tp_callback()[threadpool_common.cc:193]
      ntdll.dll!RtlFreeUnicodeString()
      ntdll.dll!RtlFreeUnicodeString()
      KERNEL32.DLL!BaseThreadInitThunk()
      ntdll.dll!RtlUserThreadStart()
      

      Attachments

        Issue Links

          Activity

            Looks like a duplicate of MDEV-20557.

            elenst Elena Stepanova added a comment - Looks like a duplicate of MDEV-20557 .

            OK to push

            sanja Oleksandr Byelkin added a comment - OK to push

            The fix will go into 10.1 (and subsequent versions)

            psergei Sergei Petrunia added a comment - The fix will go into 10.1 (and subsequent versions)

            Attempt to apply the patch to 10.1 causes this:

              mysqld: /home/psergey/dev-git/10.1/sql/item_subselect.cc:6750: void Item_subselect::init_expr_cache_tracker(THD*): Assertion `qw' failed.
              
              Thread 29 "mysqld" received signal SIGABRT, Aborted.
            

              #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
              #1  0x00007ffff5b6a8b1 in __GI_abort () at abort.c:79
              #2  0x00007ffff5b5a42a in __assert_fail_base (fmt=0x7ffff5ce1a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5555564761dc "qw", file=file@entry=0x555556474b80 "/home/psergey/dev-git/10.1/sql/item_subselect.cc", line=line@entry=6750, function=function@entry=0x555556477d80 <Item_subselect::init_expr_cache_tracker(THD*)::__PRETTY_FUNCTION__> "void Item_subselect::init_expr_cache_tracker(THD*)") at assert.c:92
              #3  0x00007ffff5b5a4a2 in __GI___assert_fail (assertion=0x5555564761dc "qw", file=0x555556474b80 "/home/psergey/dev-git/10.1/sql/item_subselect.cc", line=6750, function=0x555556477d80 <Item_subselect::init_expr_cache_tracker(THD*)::__PRETTY_FUNCTION__> "void Item_subselect::init_expr_cache_tracker(THD*)") at assert.c:101
              #4  0x0000555555d33aeb in Item_subselect::init_expr_cache_tracker (this=0x7ffeba022a00, thd=0x7ffeb6b88070) at /home/psergey/dev-git/10.1/sql/item_subselect.cc:6750
              #5  0x0000555555d252b1 in Item_singlerow_subselect::expr_cache_insert_transformer (this=0x7ffeba022a00, tmp_thd=0x7ffeb6b88070, unused=0x0) at /home/psergey/dev-git/10.1/sql/item_subselect.cc:1249
              #6  0x0000555555c9617e in Item::transform (this=0x7ffeba022a00, thd=0x7ffeb6b88070, transformer=&virtual Item::expr_cache_insert_transformer(THD*, unsigned char*), arg=0x0) at /home/psergey/dev-git/10.1/sql/item.cc:745
              #7  0x0000555555ca6df7 in Item_ref::transform (this=0x7ffeba135f20, thd=0x7ffeb6b88070, transformer=&virtual Item::expr_cache_insert_transformer(THD*, unsigned char*), arg=0x0) at /home/psergey/dev-git/10.1/sql/item.cc:7098
              #8  0x0000555555ce5811 in Item_args::transform_args (this=0x7ffeba025f18, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, arg=0x0) at /home/psergey/dev-git/10.1/sql/item_func.cc:319
              #9  0x0000555555ce58f0 in Item_func::transform (this=0x7ffeba025e90, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, argument=0x0) at /home/psergey/dev-git/10.1/sql/item_func.cc:355
              #10 0x0000555555cc3a0e in Item_cond::transform (this=0x7ffeba1393f0, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, arg=0x0) at /home/psergey/dev-git/10.1/sql/item_cmpfunc.cc:4843
              #11 0x0000555555a82ce1 in JOIN::setup_subquery_caches (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:2263
              #12 0x0000555555a815df in JOIN::optimize_inner (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1855
              #13 0x0000555555a7e858 in JOIN::optimize (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1059
              #14 0x0000555555a358c5 in st_select_lex::optimize_unflattened_subqueries (this=0x7ffeb6b8c2c0, const_only=false) at /home/psergey/dev-git/10.1/sql/sql_lex.cc:3805
              #15 0x0000555555bd5d9c in JOIN::optimize_unflattened_subqueries (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/opt_subselect.cc:5334
              #16 0x0000555555a81584 in JOIN::optimize_inner (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1849
              #17 0x0000555555a7e858 in JOIN::optimize (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1059
              #18 0x0000555555a8712d in mysql_select (thd=0x7ffeb6b88070, rref_pointer_array=0x7ffeb6b8c568, tables=0x7ffeba0264c0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7ffeba026bf8, unit=0x7ffeb6b8bbb8, select_lex=0x7ffeb6b8c2c0) at /home/psergey/dev-git/10.1/sql/sql_select.cc:3487
              #19 0x0000555555a7c922 in handle_select (thd=0x7ffeb6b88070, lex=0x7ffeb6b8baf8, result=0x7ffeba026bf8, setup_tables_done_option=0) at /home/psergey/dev-git/10.1/sql/sql_select.cc:377
              #20 0x0000555555a4c390 in execute_sqlcom_select (thd=0x7ffeb6b88070, all_tables=0x7ffeba0264c0) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:5682
              #21 0x0000555555a43055 in mysql_execute_command (thd=0x7ffeb6b88070) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:3029
              #22 0x0000555555a4fea8 in mysql_parse (thd=0x7ffeb6b88070, rawbuf=0x7ffeba021088 "select\n  (select country_id from location where location_code = cl1.cntr_dest) as dest_cntry,\n  (select \n     max(container_id) \n   from cntr_leg as cl2 \n   where\n    cl2.container_id = cl1.container_"..., length=447, parser_state=0x7ffff7ed35e0) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:7200
            

            psergei Sergei Petrunia added a comment - Attempt to apply the patch to 10.1 causes this: mysqld: /home/psergey/dev-git/10.1/sql/item_subselect.cc:6750: void Item_subselect::init_expr_cache_tracker(THD*): Assertion `qw' failed. Thread 29 "mysqld" received signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007ffff5b6a8b1 in __GI_abort () at abort.c:79 #2 0x00007ffff5b5a42a in __assert_fail_base (fmt=0x7ffff5ce1a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5555564761dc "qw", file=file@entry=0x555556474b80 "/home/psergey/dev-git/10.1/sql/item_subselect.cc", line=line@entry=6750, function=function@entry=0x555556477d80 <Item_subselect::init_expr_cache_tracker(THD*)::__PRETTY_FUNCTION__> "void Item_subselect::init_expr_cache_tracker(THD*)") at assert.c:92 #3 0x00007ffff5b5a4a2 in __GI___assert_fail (assertion=0x5555564761dc "qw", file=0x555556474b80 "/home/psergey/dev-git/10.1/sql/item_subselect.cc", line=6750, function=0x555556477d80 <Item_subselect::init_expr_cache_tracker(THD*)::__PRETTY_FUNCTION__> "void Item_subselect::init_expr_cache_tracker(THD*)") at assert.c:101 #4 0x0000555555d33aeb in Item_subselect::init_expr_cache_tracker (this=0x7ffeba022a00, thd=0x7ffeb6b88070) at /home/psergey/dev-git/10.1/sql/item_subselect.cc:6750 #5 0x0000555555d252b1 in Item_singlerow_subselect::expr_cache_insert_transformer (this=0x7ffeba022a00, tmp_thd=0x7ffeb6b88070, unused=0x0) at /home/psergey/dev-git/10.1/sql/item_subselect.cc:1249 #6 0x0000555555c9617e in Item::transform (this=0x7ffeba022a00, thd=0x7ffeb6b88070, transformer=&virtual Item::expr_cache_insert_transformer(THD*, unsigned char*), arg=0x0) at /home/psergey/dev-git/10.1/sql/item.cc:745 #7 0x0000555555ca6df7 in Item_ref::transform (this=0x7ffeba135f20, thd=0x7ffeb6b88070, transformer=&virtual Item::expr_cache_insert_transformer(THD*, unsigned char*), arg=0x0) at /home/psergey/dev-git/10.1/sql/item.cc:7098 #8 0x0000555555ce5811 in Item_args::transform_args (this=0x7ffeba025f18, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, arg=0x0) at /home/psergey/dev-git/10.1/sql/item_func.cc:319 #9 0x0000555555ce58f0 in Item_func::transform (this=0x7ffeba025e90, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, argument=0x0) at /home/psergey/dev-git/10.1/sql/item_func.cc:355 #10 0x0000555555cc3a0e in Item_cond::transform (this=0x7ffeba1393f0, thd=0x7ffeb6b88070, transformer=&virtual table offset 1056, arg=0x0) at /home/psergey/dev-git/10.1/sql/item_cmpfunc.cc:4843 #11 0x0000555555a82ce1 in JOIN::setup_subquery_caches (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:2263 #12 0x0000555555a815df in JOIN::optimize_inner (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1855 #13 0x0000555555a7e858 in JOIN::optimize (this=0x7ffeba134cc8) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1059 #14 0x0000555555a358c5 in st_select_lex::optimize_unflattened_subqueries (this=0x7ffeb6b8c2c0, const_only=false) at /home/psergey/dev-git/10.1/sql/sql_lex.cc:3805 #15 0x0000555555bd5d9c in JOIN::optimize_unflattened_subqueries (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/opt_subselect.cc:5334 #16 0x0000555555a81584 in JOIN::optimize_inner (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1849 #17 0x0000555555a7e858 in JOIN::optimize (this=0x7ffeba134088) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1059 #18 0x0000555555a8712d in mysql_select (thd=0x7ffeb6b88070, rref_pointer_array=0x7ffeb6b8c568, tables=0x7ffeba0264c0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7ffeba026bf8, unit=0x7ffeb6b8bbb8, select_lex=0x7ffeb6b8c2c0) at /home/psergey/dev-git/10.1/sql/sql_select.cc:3487 #19 0x0000555555a7c922 in handle_select (thd=0x7ffeb6b88070, lex=0x7ffeb6b8baf8, result=0x7ffeba026bf8, setup_tables_done_option=0) at /home/psergey/dev-git/10.1/sql/sql_select.cc:377 #20 0x0000555555a4c390 in execute_sqlcom_select (thd=0x7ffeb6b88070, all_tables=0x7ffeba0264c0) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:5682 #21 0x0000555555a43055 in mysql_execute_command (thd=0x7ffeb6b88070) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:3029 #22 0x0000555555a4fea8 in mysql_parse (thd=0x7ffeb6b88070, rawbuf=0x7ffeba021088 "select\n (select country_id from location where location_code = cl1.cntr_dest) as dest_cntry,\n (select \n max(container_id) \n from cntr_leg as cl2 \n where\n cl2.container_id = cl1.container_"..., length=447, parser_state=0x7ffff7ed35e0) at /home/psergey/dev-git/10.1/sql/sql_parse.cc:7200

            Basically, Item_subselect::init_expr_cache_tracker fails, because the Explain Data Structure is not yet created for the query.

            On 10.3, we also enter Item_subselect::init_expr_cache_tracker , but the Explain Data Structure is already present as it has been created here:

              #0  create_explain_query (lex=0x7fff60004b58, mem_root=0x7fff60006298) at /home/psergey/dev-git/10.3-cl/sql/sql_explain.cc:2431
              #1  0x0000555555df626f in create_explain_query_if_not_exists (lex=0x7fff60004b58, mem_root=0x7fff60006298) at /home/psergey/dev-git/10.3-cl/sql/sql_explain.cc:2439
              #2  0x0000555555c883a4 in JOIN::optimize_inner (this=0x7fff6001a0b0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:1665
              #3  0x0000555555c87c83 in JOIN::optimize (this=0x7fff6001a0b0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:1497
              #4  0x0000555555c91d54 in mysql_select (thd=0x7fff60000d50, tables=0x7fff60019a58, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff60019530, unit=0x7fff60004c18, select_lex=0x7fff600053a0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:4301
              #5  0x0000555555c833c9 in handle_select (thd=0x7fff60000d50, lex=0x7fff60004b58, result=0x7fff60019530, setup_tables_done_option=0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:370
              #6  0x0000555555c4acab in execute_sqlcom_select (thd=0x7fff60000d50, all_tables=0x7fff60019a58) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:6294
              #7  0x0000555555c413f4 in mysql_execute_command (thd=0x7fff60000d50) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:3820
              #8  0x0000555555c4efb6 in mysql_parse (thd=0x7fff60000d50, rawbuf=0x7fff600139b8 "select   (select country_id from location where location_code = cl1.cntr_dest) as dest_cntry,   (select       max(container_id)     from cntr_leg as cl2     where     cl2.container_id = cl1.container_"..., length=447, parser_state=0x7fffd981e5c0, is_com_multi=false, is_next_command=false) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:7818
            

            ... note that the create_explain_query_if_not_exists() call is inside a

              if (sel->first_cond_optimization)
              {
            

            block.
            Indeed, if I run the test query inside a PREPARE; EXECUTE; EXECUTE block, then 10.3 crashes in the same way as 10.1 does.

            psergei Sergei Petrunia added a comment - Basically, Item_subselect::init_expr_cache_tracker fails, because the Explain Data Structure is not yet created for the query. On 10.3, we also enter Item_subselect::init_expr_cache_tracker , but the Explain Data Structure is already present as it has been created here: #0 create_explain_query (lex=0x7fff60004b58, mem_root=0x7fff60006298) at /home/psergey/dev-git/10.3-cl/sql/sql_explain.cc:2431 #1 0x0000555555df626f in create_explain_query_if_not_exists (lex=0x7fff60004b58, mem_root=0x7fff60006298) at /home/psergey/dev-git/10.3-cl/sql/sql_explain.cc:2439 #2 0x0000555555c883a4 in JOIN::optimize_inner (this=0x7fff6001a0b0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:1665 #3 0x0000555555c87c83 in JOIN::optimize (this=0x7fff6001a0b0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:1497 #4 0x0000555555c91d54 in mysql_select (thd=0x7fff60000d50, tables=0x7fff60019a58, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff60019530, unit=0x7fff60004c18, select_lex=0x7fff600053a0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:4301 #5 0x0000555555c833c9 in handle_select (thd=0x7fff60000d50, lex=0x7fff60004b58, result=0x7fff60019530, setup_tables_done_option=0) at /home/psergey/dev-git/10.3-cl/sql/sql_select.cc:370 #6 0x0000555555c4acab in execute_sqlcom_select (thd=0x7fff60000d50, all_tables=0x7fff60019a58) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:6294 #7 0x0000555555c413f4 in mysql_execute_command (thd=0x7fff60000d50) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:3820 #8 0x0000555555c4efb6 in mysql_parse (thd=0x7fff60000d50, rawbuf=0x7fff600139b8 "select (select country_id from location where location_code = cl1.cntr_dest) as dest_cntry, (select max(container_id) from cntr_leg as cl2 where cl2.container_id = cl1.container_"..., length=447, parser_state=0x7fffd981e5c0, is_com_multi=false, is_next_command=false) at /home/psergey/dev-git/10.3-cl/sql/sql_parse.cc:7818 ... note that the create_explain_query_if_not_exists() call is inside a if (sel->first_cond_optimization) { block. Indeed, if I run the test query inside a PREPARE; EXECUTE; EXECUTE block, then 10.3 crashes in the same way as 10.1 does.

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.