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

SIGSEGV in Item_func_group_concat::add on JSON_ARRAYAGG query (on optimized builds)

    XMLWordPrintable

Details

    Description

      SELECT JSON_ARRAYAGG(NULL) FROM (SELECT 1 AS t) AS A;
      

      Leads to:

      10.5.3 f544a712c8a2ef3f3ecba80cb2782b1839fb36ab

      Core was generated by `/test/MD010520-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 0x7eff6776f700 (LWP 2322028))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000556b618d5ac7 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
      #2  0x0000556b612977ca in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  0x0000556b6135a854 in Item_func_group_concat::add (this=0x7eff318477a8, exclude_nulls=false) at /test/10.5_opt/sql/item_sum.cc:3999
      #5  0x0000556b610caba8 in Item_sum::aggregator_add (this=0x7eff318477a8) at /test/10.5_opt/sql/item_sum.h:560
      #6  Item_sum::reset_and_add (this=0x7eff318477a8) at /test/10.5_opt/sql/item_sum.h:445
      #7  init_sum_functions (func_ptr=0x7eff3184a758, end_ptr=0x7eff3184a760) at /test/10.5_opt/sql/sql_select.cc:25651
      #8  0x0000556b610f367c in end_send_group (join=0x7eff318499b0, join_tab=<optimized out>, end_of_records=<optimized out>) at /test/10.5_opt/sql/sql_select.cc:22007
      #9  0x0000556b61100610 in do_select (procedure=<optimized out>, join=0x7eff318499b0) at /test/10.5_opt/sql/sql_select.cc:20096
      #10 JOIN::exec_inner (this=this@entry=0x7eff318499b0) at /test/10.5_opt/sql/sql_select.cc:4464
      #11 0x0000556b61100887 in JOIN::exec (this=this@entry=0x7eff318499b0) at /test/10.5_opt/sql/sql_select.cc:4245
      #12 0x0000556b610febd2 in mysql_select (thd=thd@entry=0x7eff31812018, tables=0x7eff318489d0, fields=..., conds=0x0, og_num=<optimized out>, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7eff31849988, unit=0x7eff31815e68, select_lex=0x7eff31847260) at /test/10.5_opt/sql/sql_select.cc:4669
      #13 0x0000556b610ff591 in handle_select (thd=thd@entry=0x7eff31812018, lex=lex@entry=0x7eff31815da0, result=result@entry=0x7eff31849988, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_opt/sql/sql_select.cc:417
      #14 0x0000556b610a6171 in execute_sqlcom_select (thd=thd@entry=0x7eff31812018, all_tables=0x7eff318489d0) at /test/10.5_opt/sql/sql_parse.cc:6172
      #15 0x0000556b610a2092 in mysql_execute_command (thd=thd@entry=0x7eff31812018) at /test/10.5_opt/sql/sql_parse.cc:3901
      #16 0x0000556b610a922c in mysql_parse (thd=0x7eff31812018, rawbuf=<optimized out>, length=52, parser_state=0x7eff6776e4d0, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:7957
      #17 0x0000556b6109e855 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7eff31812018, packet=packet@entry=0x7eff3183a019 "", packet_length=packet_length@entry=52, 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
      #18 0x0000556b6109cae6 in do_command (thd=0x7eff31812018) at /test/10.5_opt/sql/sql_parse.cc:1358
      #19 0x0000556b6119129e in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7eff654329b8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1422
      #20 0x0000556b61191444 in handle_one_connection (arg=arg@entry=0x7eff654329b8) at /test/10.5_opt/sql/sql_connect.cc:1319
      #21 0x0000556b614fd53a in pfs_spawn_thread (arg=0x7eff6544b018) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #22 0x00007eff66b966db in start_thread (arg=0x7eff6776f700) at pthread_create.c:463
      #23 0x00007eff65f9488f 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), 10.5.4 (dbg), 10.5.4 (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

              holyfoot Alexey Botchkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.