[MDEV-16174] Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) Created: 2018-05-15  Updated: 2018-11-09  Resolved: 2018-11-09

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.2.19

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-12363 Assertion `0' failed in Type_handler_... Closed

 Description   

--source include/have_innodb.inc
SET sql_mode='';
CREATE TABLE t1 (fld varchar(16) NOT NULL) ENGINE=InnoDB;
INSERT INTO t1 VALUES ("false");
SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1 ORDER BY 1;

Thread 1 (Thread 0x7f4754093700 (LWP 19582)):
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000561d3c21ae23 in my_write_core (sig=6) at /home/alice/git/10.2/mysys/stacktrace.c:477
#2  0x0000561d3bab4d31 in handle_fatal_signal (sig=6) at /home/alice/git/10.2/sql/signal_handler.cc:305
#3  <signal handler called>
#4  0x00007f4759dc0428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f4759dc202a in __GI_abort () at abort.c:89
#6  0x00007f4759db8bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x561d3c3f85db "0", file=file@entry=0x561d3c3f8298 "/home/alice/git/10.2/sql/filesort.cc", line=line@entry=1020, function=function@entry=0x561d3c3f8d40 <Type_handler_string_result::make_sort_key(unsigned char*, Item*, SORT_FIELD_ATTR const*, Sort_param*) const::__PRETTY_FUNCTION__> "virtual void Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const") at assert.c:92
#7  0x00007f4759db8c82 in __GI___assert_fail (assertion=0x561d3c3f85db "0", file=0x561d3c3f8298 "/home/alice/git/10.2/sql/filesort.cc", line=1020, function=0x561d3c3f8d40 <Type_handler_string_result::make_sort_key(unsigned char*, Item*, SORT_FIELD_ATTR const*, Sort_param*) const::__PRETTY_FUNCTION__> "virtual void Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const") at assert.c:101
#8  0x0000561d3bab0f60 in Type_handler_string_result::make_sort_key (this=0x561d3ce5bca8 <type_handler_varchar>, to=0x7f47081639a8 "\220\070\026\bG\177", item=0x7f470817d9d0, sort_field=0x7f47080674e0, param=0x7f4754090960) at /home/alice/git/10.2/sql/filesort.cc:1020
#9  0x0000561d3b77e401 in Item::make_sort_key (this=0x7f470817d9d0, to=0x7f47081639a8 "\220\070\026\bG\177", item=0x7f470817d9d0, sort_field=0x7f47080674e0, param=0x7f4754090960) at /home/alice/git/10.2/sql/item.h:887
#10 0x0000561d3bab1677 in make_sortkey (param=0x7f4754090960, to=0x7f47081639a8 "\220\070\026\bG\177", ref_pos=0x7f47080663a0 "") at /home/alice/git/10.2/sql/filesort.cc:1187
#11 0x0000561d3bab083c in find_all_keys (thd=0x7f4708000a98, param=0x7f4754090960, select=0x7f47080fa820, fs_info=0x7f4708184a40, buffpek_pointers=0x7f4754090b60, tempfile=0x7f47540909f0, pq=0x0, found_rows=0x7f4708184c20) at /home/alice/git/10.2/sql/filesort.cc:862
#12 0x0000561d3baaeadd in filesort (thd=0x7f4708000a98, table=0x7f47080f93e8, filesort=0x7f4708007700, tracker=0x7f47081432b8, join=0x7f470817c8c0, first_table_bit=1) at /home/alice/git/10.2/sql/filesort.cc:279
#13 0x0000561d3b8ba739 in create_sort_index (thd=0x7f4708000a98, join=0x7f470817c8c0, tab=0x7f47081842d0, fsort=0x7f4708007700) at /home/alice/git/10.2/sql/sql_select.cc:21819
#14 0x0000561d3b8b513e in st_join_table::sort_table (this=0x7f47081842d0) at /home/alice/git/10.2/sql/sql_select.cc:19654
#15 0x0000561d3b8b4d88 in join_init_read_record (tab=0x7f47081842d0) at /home/alice/git/10.2/sql/sql_select.cc:19595
#16 0x0000561d3b8b2d48 in sub_select (join=0x7f470817c8c0, join_tab=0x7f47081842d0, end_of_records=false) at /home/alice/git/10.2/sql/sql_select.cc:18690
#17 0x0000561d3b8b233e in do_select (join=0x7f470817c8c0, procedure=0x0) at /home/alice/git/10.2/sql/sql_select.cc:18237
#18 0x0000561d3b88cdab in JOIN::exec_inner (this=0x7f470817c8c0) at /home/alice/git/10.2/sql/sql_select.cc:3568
#19 0x0000561d3b88c24c in JOIN::exec (this=0x7f470817c8c0) at /home/alice/git/10.2/sql/sql_select.cc:3363
#20 0x0000561d3b88d41c in mysql_select (thd=0x7f4708000a98, tables=0x7f47080fa1a0, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f4708180cd0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f470814af10, unit=0x7f4708004640, select_lex=0x7f4708004d98) at /home/alice/git/10.2/sql/sql_select.cc:3763
#21 0x0000561d3b8819e8 in handle_select (thd=0x7f4708000a98, lex=0x7f4708004578, result=0x7f470814af10, setup_tables_done_option=0) at /home/alice/git/10.2/sql/sql_select.cc:376
#22 0x0000561d3b84d5d0 in execute_sqlcom_select (thd=0x7f4708000a98, all_tables=0x7f47080fa1a0) at /home/alice/git/10.2/sql/sql_parse.cc:6476
#23 0x0000561d3b843311 in mysql_execute_command (thd=0x7f4708000a98) at /home/alice/git/10.2/sql/sql_parse.cc:3483
#24 0x0000561d3b851166 in mysql_parse (thd=0x7f4708000a98, rawbuf=0x7f4708185750 "SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1 ORDER BY 1", length=62, parser_state=0x7f47540921f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:7940
#25 0x0000561d3b83eb70 in dispatch_command (command=COM_QUERY, thd=0x7f4708000a98, packet=0x7f4708007f39 "", packet_length=62, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:1820
#26 0x0000561d3b83d4cc in do_command (thd=0x7f4708000a98) at /home/alice/git/10.2/sql/sql_parse.cc:1374
#27 0x0000561d3b98c407 in do_handle_one_connection (connect=0x561d3efe2548) at /home/alice/git/10.2/sql/sql_connect.cc:1335
#28 0x0000561d3b98c187 in handle_one_connection (arg=0x561d3efe2548) at /home/alice/git/10.2/sql/sql_connect.cc:1241
#29 0x0000561d3c1b887e in pfs_spawn_thread (arg=0x561d3ef67f48) at /home/alice/git/10.2/storage/perfschema/pfs.cc:1862
#30 0x00007f475a9fd6ba in start_thread (arg=0x7f4754093700) at pthread_create.c:333
#31 0x00007f4759e9241d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109



 Comments   
Comment by Alexey Botchkov [ 2018-11-09 ]

Fix proposal
http://lists.askmonty.org/pipermail/commits/2018-November/013076.html

Generated at Thu Feb 08 08:26:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.