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

SIGSEGV in copy_fields on JSON SELECT query (optimized builds)

    XMLWordPrintable

    Details

      Description

      SELECT 0 &(JSON_ARRAYAGG(1) OVER a) FROM (SELECT 0) AS b WINDOW a AS ();
      

      Leads to:

      10.5.3 181f17c3cd4366f58d9efbff9d7556bb49742ed4

      Core was generated by `/test/MD180420-mariadb-10.5.3-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:57
      [Current thread is 1 (Thread 0x7f3e2a967700 (LWP 28046))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x00005627f44b8e87 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
      #2  0x00005627f3e7b2ca in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  copy_fields (param=0x0) at /test/10.5_opt/sql/sql_select.cc:25280
      #5  0x00005627f3f3e59c in Item_func_group_concat::add (this=0x7f3df8447878, exclude_nulls=false) at /test/10.5_opt/sql/item_sum.cc:3998
      #6  0x00005627f3de9759 in Frame_cursor::add_value_to_items (this=this@entry=0x7f3df84c24a0) at /test/10.5_opt/sql/sql_window.cc:1104
      #7  0x00005627f3df0f3a in Frame_cursor::add_value_to_items (this=0x7f3df84c24a0) at /test/10.5_opt/sql/sql_window.cc:1097
      #8  Frame_scan_cursor::compute_values_for_current_row (this=0x7f3df84c24a0) at /test/10.5_opt/sql/sql_window.cc:2211
      #9  0x00005627f3debf09 in Cursor_manager::notify_cursors_partition_changed (rownum=0, this=0x7f3df84460a0) at /test/10.5_opt/sql/sql_window.cc:1167
      #10 compute_window_func (thd=thd@entry=0x7f3df8412018, window_functions=..., cursor_managers=..., tbl=tbl@entry=0x7f3df849f030, filesort_result=filesort_result@entry=0x7f3df84f0300) at /test/10.5_opt/sql/sql_window.cc:2845
      #11 0x00005627f3dec2d6 in Window_func_runner::exec (this=this@entry=0x7f3df844c938, thd=thd@entry=0x7f3df8412018, tbl=0x7f3df849f030, filesort_result=0x7f3df84f0300) at /test/10.5_opt/sql/sql_window.cc:2971
      #12 0x00005627f3dec3f6 in Window_funcs_sort::exec (this=0x7f3df844c930, join=join@entry=0x7f3df8449cd8, keep_filesort_result=<optimized out>) at /test/10.5_opt/sql/sql_window.cc:2996
      #13 0x00005627f3decce5 in Window_funcs_computation::exec (this=0x7f3df844c910, join=join@entry=0x7f3df8449cd8, keep_last_filesort_result=<optimized out>) at /test/10.5_opt/sql/sql_window.cc:3122
      #14 0x00005627f3cdc653 in AGGR_OP::end_send (this=0x7f3df844c7a0) at /test/10.5_opt/sql/sql_select.cc:28869
      #15 0x00005627f3cdc83e in sub_select_postjoin_aggr (join=0x7f3df8449cd8, join_tab=0x7f3df844bd30, end_of_records=<optimized out>) at /test/10.5_opt/sql/sql_select.cc:20315
      #16 0x00005627f3ce3fbd in do_select (procedure=<optimized out>, join=0x7f3df8449cd8) at /test/10.5_opt/sql/sql_select.cc:20141
      #17 JOIN::exec_inner (this=this@entry=0x7f3df8449cd8) at /test/10.5_opt/sql/sql_select.cc:4463
      #18 0x00005627f3ce43c7 in JOIN::exec (this=this@entry=0x7f3df8449cd8) at /test/10.5_opt/sql/sql_select.cc:4244
      #19 0x00005627f3ce2712 in mysql_select (thd=thd@entry=0x7f3df8412018, tables=0x7f3df8448c60, fields=..., conds=0x0, og_num=<optimized out>, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f3df8449cb0, unit=0x7f3df8415e60, select_lex=0x7f3df8447280) at /test/10.5_opt/sql/sql_select.cc:4668
      #20 0x00005627f3ce30d1 in handle_select (thd=thd@entry=0x7f3df8412018, lex=lex@entry=0x7f3df8415d98, result=result@entry=0x7f3df8449cb0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_opt/sql/sql_select.cc:417
      #21 0x00005627f3c899b1 in execute_sqlcom_select (thd=thd@entry=0x7f3df8412018, all_tables=0x7f3df8448c60) at /test/10.5_opt/sql/sql_parse.cc:6168
      #22 0x00005627f3c84c53 in mysql_execute_command (thd=thd@entry=0x7f3df8412018) at /test/10.5_opt/sql/sql_parse.cc:3901
      #23 0x00005627f3c8cb9c in mysql_parse (thd=thd@entry=0x7f3df8412018, rawbuf=<optimized out>, length=71, parser_state=parser_state@entry=0x7f3e2a9664d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:7953
      #24 0x00005627f3c81a10 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f3df8412018, packet=packet@entry=0x7f3df843a019 "", packet_length=packet_length@entry=71, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1839
      #25 0x00005627f3c7fd2f in do_command (thd=0x7f3df8412018) at /test/10.5_opt/sql/sql_parse.cc:1358
      #26 0x00005627f3d74d7e in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f3e284329b8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1422
      #27 0x00005627f3d74f24 in handle_one_connection (arg=arg@entry=0x7f3e284329b8) at /test/10.5_opt/sql/sql_connect.cc:1319
      #28 0x00005627f40e152a in pfs_spawn_thread (arg=0x7f3e2844b018) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #29 0x00007f3e29d8e6db in start_thread (arg=0x7f3e2a967700) at pthread_create.c:463
      #30 0x00007f3e2918c88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.2 (dbg), 10.5.2 (opt), 10.5.3 (dbg), 10.5.3 (opt)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: