Assertion `length == 0 || json_binary::parse_binary(ptr, length).is_valid()' failed in sql/field.cc:8975: type_conversion_status Field_json::store_binary(const char*, size_t)

Bug #1536469 reported by Ramesh Sivaraman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Invalid
Undecided
Unassigned
5.6
Invalid
Undecided
Unassigned
5.7
Fix Released
High
Laurynas Biveinis

Bug Description

** Testcase

# mysqld options required for replay: --sql_mode=ONLY_FULL_GROUP_BY
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t0(a int,b int,key using BTREE (a,b),key using BTREE (b)) ENGINE=HEAP;
ALTER TABLE t0 ADD COLUMN utf0k json;
INSERT INTO t0 values(0,0,'0'),(0,0,'0'),(0,0,'0'),(0,0,'0'),(0,0,'0');
INSERT INTO t0 VALUES(0,'MySQL Tutorial','DBMS stands for DataBase ...'),(0,'How To Use MySQL Well','After you went through a ...'),(0,'Optimizing MySQL','In this tutorial we will show ...');
insert INTO t0 select * FROM t0;

PS : Attached error log with bug bundle.

** How to reproduce :

The attached tarball (1453347541_bug_bundle.tar.gz) gives the testcase as an exact match of our system, including some handy utilities

$ vi 1453347541_mybase # STEP1: Update the base path in this file (usually the only change required!). If you use a non-binary distribution, please update SOURCE_DIR location also
$ ./1453347541_init # STEP2: Initializes the data dir
$ ./1453347541_start # STEP3: Starts mysqld
$ ./1453347541_cl # STEP4: To check mysqld is up
$ ./1453347541_run_pquery # STEP5: Run the testcase with the pquery binary
$ ./1453347541_run # OPTIONAL: Run the testcase with the mysql CLI (may not reproduce the issue, as the pquery binary was used for the original testcase reduction)
$ vi /dev/shm/1453347541/error.log.out # STEP6: Verify the error log
$ ./1453347541_gdb # OPTIONAL: Brings you to a gdb prompt with gdb attached to the used mysqld and attached to the generated core
$ ./1453347541_parse_core # STEP7: Creates 1453347541_STD.gdb and 1453347541_FULL.gdb; standard and full variables gdb stack traces

** GDB info

#0 0x00007f7882a91741 in pthread_kill () from /lib64/libpthread.so.0
#1 0x0000000001811a80 in my_write_core (sig=6) at /sda/ps5.7/PS-5.7_dbg/mysys/stacktrace.c:247
#2 0x0000000000e60b43 in handle_fatal_signal (sig=6) at /sda/ps5.7/PS-5.7_dbg/sql/signal_handler.cc:223
#3 <signal handler called>
#4 0x00007f7880c1e5f7 in raise () from /lib64/libc.so.6
#5 0x00007f7880c1fce8 in abort () from /lib64/libc.so.6
#6 0x00007f7880c17566 in __assert_fail_base () from /lib64/libc.so.6
#7 0x00007f7880c17612 in __assert_fail () from /lib64/libc.so.6
#8 0x0000000000ec756d in Field_json::store_binary (this=0x7f78458ae1b0, ptr=0x7f78458460a0 "t0", length=3) at /sda/ps5.7/PS-5.7_dbg/sql/field.cc:8975
#9 0x0000000000ec7818 in Field_json::store (this=0x7f78458ae1b0, field=0x7f78458aed80) at /sda/ps5.7/PS-5.7_dbg/sql/field.cc:9053
#10 0x0000000001691e86 in field_conv (to=0x7f78458ae1b0, from=0x7f78458aed80) at /sda/ps5.7/PS-5.7_dbg/sql/field_conv.cc:900
#11 0x0000000000f17aa1 in Item_field::save_in_field_inner (this=0x7f7845963f00, to=0x7f78458ae1b0, no_conversions=false) at /sda/ps5.7/PS-5.7_dbg/sql/item.cc:6676
#12 0x0000000000f17b3e in Item::save_in_field (this=0x7f7845963f00, field=0x7f78458ae1b0, no_conversions=false) at /sda/ps5.7/PS-5.7_dbg/sql/item.cc:6723
#13 0x000000000148a432 in fill_record (thd=0x7f7845819000, table=0x7f784585b220, ptr=0x7f78458ae078, values=..., bitmap=0x0, insert_into_fields_bitmap=0x0) at /sda/ps5.7/PS-5.7_dbg/sql/sql_base.cc:9528
#14 0x000000000148a707 in fill_record_n_invoke_before_triggers (thd=0x7f7845819000, ptr=0x7f78458ae060, values=..., table=0x7f784585b220, event=TRG_EVENT_INSERT, num_fields=3) at /sda/ps5.7/PS-5.7_dbg/sql/sql_base.cc:9610
#15 0x00000000017062f0 in Query_result_insert::store_values (this=0x7f784582c8c8, values=...) at /sda/ps5.7/PS-5.7_dbg/sql/sql_insert.cc:2301
#16 0x0000000001705f6e in Query_result_insert::send_data (this=0x7f784582c8c8, values=...) at /sda/ps5.7/PS-5.7_dbg/sql/sql_insert.cc:2232
#17 0x00000000014c4053 in end_send (join=0x7f7845963030, qep_tab=0x7f7845963aa8, end_of_records=false) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:2905
#18 0x00000000014c0d13 in evaluate_join_record (join=0x7f7845963030, qep_tab=0x7f7845963930) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:1636
#19 0x00000000014c8c06 in QEP_tmp_table::end_send (this=0x7f784582cfa0) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:4697
#20 0x00000000014bfd83 in sub_select_op (join=0x7f7845963030, qep_tab=0x7f7845963930, end_of_records=true) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:1063
#21 0x00000000014bfeb6 in sub_select (join=0x7f7845963030, qep_tab=0x7f78459637b8, end_of_records=true) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:1220
#22 0x00000000014bfa36 in do_select (join=0x7f7845963030) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:946
#23 0x00000000014bd98b in JOIN::exec (this=0x7f7845963030) at /sda/ps5.7/PS-5.7_dbg/sql/sql_executor.cc:199
#24 0x0000000001559576 in handle_query (thd=0x7f7845819000, lex=0x7f784581b5d0, result=0x7f784582c8c8, added_options=1342177280, removed_options=0) at /sda/ps5.7/PS-5.7_dbg/sql/sql_select.cc:184
#25 0x0000000001708bc4 in Sql_cmd_insert_select::execute (this=0x7f784582c850, thd=0x7f7845819000) at /sda/ps5.7/PS-5.7_dbg/sql/sql_insert.cc:3189
#26 0x0000000001509669 in mysql_execute_command (thd=0x7f7845819000, first_level=true) at /sda/ps5.7/PS-5.7_dbg/sql/sql_parse.cc:3676
#27 0x000000000150f32a in mysql_parse (thd=0x7f7845819000, parser_state=0x7f7883047500) at /sda/ps5.7/PS-5.7_dbg/sql/sql_parse.cc:5786
#28 0x0000000001504341 in dispatch_command (thd=0x7f7845819000, com_data=0x7f7883047c90, command=COM_QUERY) at /sda/ps5.7/PS-5.7_dbg/sql/sql_parse.cc:1445
#29 0x000000000150325b in do_command (thd=0x7f7845819000) at /sda/ps5.7/PS-5.7_dbg/sql/sql_parse.cc:1008
#30 0x000000000163ad13 in handle_connection (arg=0x7f786ebfec10) at /sda/ps5.7/PS-5.7_dbg/sql/conn_handler/connection_handler_per_thread.cc:313
#31 0x00000000018b119c in pfs_spawn_thread (arg=0x7f786e3f1120) at /sda/ps5.7/PS-5.7_dbg/storage/perfschema/pfs.cc:2192
#32 0x00007f7882a8cdc5 in start_thread () from /lib64/libpthread.so.0
#33 0x00007f7880cdf21d in clone () from /lib64/libc.so.6

Tags: memory-se qa qa57
Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :
Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

Please run the testcase with pquery binary to reproduce the issue : ie STEP 5.

tags: added: memory-se
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Reduced MTR testcase, does note require specific startup options. Does not crash w/ MyISAM or InnoDB, have not tested TokuDB.

CREATE TABLE t0(utf0k json) ENGINE=HEAP;
INSERT INTO t0 values('0');
--error 3140
INSERT INTO t0 VALUES('DBMS stands for DataBase ...');
SELECT * FROM t0;
DROP TABLE t0;

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3363

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.