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

Assertion `je->s.cs == nice_js->charset()' still fails in json_nice

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Cannot Reproduce
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL)
    • N/A
    • JSON
    • None

    Description

      The patch for MDEV-24585 is already in main branches, and the test case from there doesn't fail anymore. But this does.

      SELECT JSON_INSERT( JSON_MERGE_PATCH( '{}', CONVERT('"foo"' USING BINARY) ), '$', NULL );
      

      10.2 026984c3

      mysqld: /data/src/10.2/sql/item_jsonfunc.cc:140: int json_nice(json_engine_t*, String*, Item_func_json_format::formats, int): Assertion `je->s.cs == nice_js->charset()' failed.
      211103  2:49:31 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa3de3a9f36 in __GI___assert_fail (assertion=0x555e492e6e60 "je->s.cs == nice_js->charset()", file=0x555e492e6e38 "/data/src/10.2/sql/item_jsonfunc.cc", line=140, function=0x555e492e6de8 "int json_nice(json_engine_t*, String*, Item_func_json_format::formats, int)") at assert.c:101
      #8  0x0000555e48bbac3d in json_nice (je=0x7fa3d83b5d80, nice_js=0x7fa3d83b5f70, mode=Item_func_json_format::LOOSE, tab_size=4) at /data/src/10.2/sql/item_jsonfunc.cc:140
      #9  0x0000555e48bc5771 in Item_func_json_insert::val_str (this=0x7fa3c8012fb8, str=0x7fa3d83b5f70) at /data/src/10.2/sql/item_jsonfunc.cc:2966
      #10 0x0000555e48a09b47 in Item::send (this=0x7fa3c8012fb8, protocol=0x7fa3c8001348, buffer=0x7fa3d83b5f70) at /data/src/10.2/sql/item.cc:6975
      #11 0x0000555e4867c34d in Protocol::send_result_set_row (this=0x7fa3c8001348, row_items=0x7fa3c8005200) at /data/src/10.2/sql/protocol.cc:989
      #12 0x0000555e48713422 in select_send::send_data (this=0x7fa3c8013298, items=...) at /data/src/10.2/sql/sql_class.cc:2788
      #13 0x0000555e487a5bb3 in JOIN::exec_inner (this=0x7fa3c80132b8) at /data/src/10.2/sql/sql_select.cc:3527
      #14 0x0000555e487a5620 in JOIN::exec (this=0x7fa3c80132b8) at /data/src/10.2/sql/sql_select.cc:3446
      #15 0x0000555e487a67fa in mysql_select (thd=0x7fa3c8000d90, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fa3c8013298, unit=0x7fa3c8004988, select_lex=0x7fa3c80050d8) at /data/src/10.2/sql/sql_select.cc:3849
      #16 0x0000555e4879a94e in handle_select (thd=0x7fa3c8000d90, lex=0x7fa3c80048c8, result=0x7fa3c8013298, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #17 0x0000555e48764f22 in execute_sqlcom_select (thd=0x7fa3c8000d90, all_tables=0x0) at /data/src/10.2/sql/sql_parse.cc:6271
      #18 0x0000555e4875ba96 in mysql_execute_command (thd=0x7fa3c8000d90) at /data/src/10.2/sql/sql_parse.cc:3582
      #19 0x0000555e48768cde in mysql_parse (thd=0x7fa3c8000d90, rawbuf=0x7fa3c8012850 "SELECT JSON_INSERT( JSON_MERGE_PATCH( '{}', CONVERT('\"foo\"' USING BINARY) ), '$', NULL )", length=88, parser_state=0x7fa3d83b7560, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7793
      #20 0x0000555e48756f39 in dispatch_command (command=COM_QUERY, thd=0x7fa3c8000d90, packet=0x7fa3c8008b61 "", packet_length=88, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #21 0x0000555e48755a34 in do_command (thd=0x7fa3c8000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #22 0x0000555e488b1a81 in do_handle_one_connection (connect=0x555e4ba2d0d0) at /data/src/10.2/sql/sql_connect.cc:1336
      #23 0x0000555e488b17e6 in handle_one_connection (arg=0x555e4ba2d0d0) at /data/src/10.2/sql/sql_connect.cc:1241
      #24 0x0000555e490dc0a2 in pfs_spawn_thread (arg=0x555e4ba104d0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #25 0x00007fa3de8bc609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #26 0x00007fa3de495293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on all of 10.2-10.7.
      No obvious immediate problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            SELECT json_set(json_arrayagg('j') , '$."a"', 1);
            

            10.5/src/sql/item_jsonfunc.cc:140: int json_nice(json_engine_t*, String*, Item_func_json_format::formats, int): Assertion `je->s.cs == nice_js->charset()' failed.
            211110 17:47:42 [ERROR] mysqld got signal 6 ;
             
            sql/item_jsonfunc.cc:141(json_nice(st_json_engine_t*, String*, Item_func_json_format::formats, int))[0x55900c3e81fd]
            sql/item_jsonfunc.cc:3001(Item_func_json_insert::val_str(String*))[0x55900c401b52]
            sql/sql_type.cc:7441(Type_handler::Item_send_str(Item*, Protocol*, st_value*) const)[0x55900bc43e4e]
            sql/sql_type.h:5438(Type_handler_string_result::Item_send(Item*, Protocol*, st_value*) const)[0x55900ba69aea]
            sql/item.h:1067(Item::send(Protocol*, st_value*))[0x55900b3aaf62]
            sql/protocol.cc:1083(Protocol::send_result_set_row(List<Item>*))[0x55900b39b80d]
            sql/sql_class.cc:3081(select_send::send_data(List<Item>&))[0x55900b54f3be]
            sql/sql_class.h:5342(select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long))[0x55900b813d65]
            sql/sql_select.cc:22235(end_send_group(JOIN*, st_join_table*, bool))[0x55900b7d04e5]
            sql/sql_select.cc:20348(do_select(JOIN*, Procedure*))[0x55900b7c30c3]
            sql/sql_select.cc:4516(JOIN::exec_inner())[0x55900b74f5d9]
            sql/sql_select.cc:4297(JOIN::exec())[0x55900b74cbe8]
            sql/sql_select.cc:4775(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55900b751029]
            sql/sql_select.cc:444(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55900b72252d]
            sql/sql_parse.cc:6314(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55900b68a32d]
            sql/sql_parse.cc:4005(mysql_execute_command(THD*))[0x55900b6792ce]
            sql/sql_parse.cc:8100(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55900b695686]
            sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55900b66b547]
            sql/sql_parse.cc:1370(do_command(THD*))[0x55900b667e86]
            sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x55900bab2ce1]
            sql/sql_connect.cc:1314(handle_one_connection)[0x55900bab24fa]
            perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55900c7cc8cb]
            nptl/pthread_create.c:478(start_thread)[0x7f1a42c2d609]
            ??:0(clone)[0x7f1a42800293]
             
            Query (0x62b0000852a8): SELECT json_set(json_arrayagg('j') , '$."a"', 1)
            

            alice Alice Sherepa added a comment - SELECT json_set(json_arrayagg( 'j' ) , '$."a"' , 1); 10.5/src/sql/item_jsonfunc.cc:140: int json_nice(json_engine_t*, String*, Item_func_json_format::formats, int): Assertion `je->s.cs == nice_js->charset()' failed. 211110 17:47:42 [ERROR] mysqld got signal 6 ;   sql/item_jsonfunc.cc:141(json_nice(st_json_engine_t*, String*, Item_func_json_format::formats, int))[0x55900c3e81fd] sql/item_jsonfunc.cc:3001(Item_func_json_insert::val_str(String*))[0x55900c401b52] sql/sql_type.cc:7441(Type_handler::Item_send_str(Item*, Protocol*, st_value*) const)[0x55900bc43e4e] sql/sql_type.h:5438(Type_handler_string_result::Item_send(Item*, Protocol*, st_value*) const)[0x55900ba69aea] sql/item.h:1067(Item::send(Protocol*, st_value*))[0x55900b3aaf62] sql/protocol.cc:1083(Protocol::send_result_set_row(List<Item>*))[0x55900b39b80d] sql/sql_class.cc:3081(select_send::send_data(List<Item>&))[0x55900b54f3be] sql/sql_class.h:5342(select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long))[0x55900b813d65] sql/sql_select.cc:22235(end_send_group(JOIN*, st_join_table*, bool))[0x55900b7d04e5] sql/sql_select.cc:20348(do_select(JOIN*, Procedure*))[0x55900b7c30c3] sql/sql_select.cc:4516(JOIN::exec_inner())[0x55900b74f5d9] sql/sql_select.cc:4297(JOIN::exec())[0x55900b74cbe8] sql/sql_select.cc:4775(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55900b751029] sql/sql_select.cc:444(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55900b72252d] sql/sql_parse.cc:6314(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55900b68a32d] sql/sql_parse.cc:4005(mysql_execute_command(THD*))[0x55900b6792ce] sql/sql_parse.cc:8100(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55900b695686] sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55900b66b547] sql/sql_parse.cc:1370(do_command(THD*))[0x55900b667e86] sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x55900bab2ce1] sql/sql_connect.cc:1314(handle_one_connection)[0x55900bab24fa] perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55900c7cc8cb] nptl/pthread_create.c:478(start_thread)[0x7f1a42c2d609] ??:0(clone)[0x7f1a42800293]   Query (0x62b0000852a8): SELECT json_set(json_arrayagg('j') , '$."a"', 1)
            alice Alice Sherepa added a comment -

            not reproducible on current 10.5 5777d9f2821011101423209a1e4994939ef44818 -11.6

            alice Alice Sherepa added a comment - not reproducible on current 10.5 5777d9f2821011101423209a1e4994939ef44818 -11.6

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.