Bug #76438 get_real_type assertion failed in sql/item.cc:9826
Submitted: 23 Mar 2015 0:39 Modified: 23 Mar 2015 7:01
Reporter: Roel Van de Paar Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:5.7.5-m16 OS:Any
Assigned to: CPU Architecture:Any

[23 Mar 2015 0:39] Roel Van de Paar
Description:
mysqld: /bzr/mysql-5.7.6-m16_dbg/sql/item.cc:9826: void Item_type_holder::get_full_info(Item*): Assertion `(enum_set_typelib && get_real_type(item) == MYSQL_TYPE_NULL) || (!enum_set_typelib && item->type() == Item::FIELD_ITEM && (get_real_type(item) == MYSQL_TYPE_ENUM || get_real_type(item) == MYSQL_TYPE_SET) && ((Field_enum*)((Item_field *) item)->field)->typelib)' failed.

+bt
#0  0x00007f37c6606771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013a521c in my_write_core (sig=6) at /bzr/mysql-5.7.6-m16_dbg/mysys/stacktrace.c:247
#2  0x0000000000bb713c in handle_fatal_signal (sig=6) at /bzr/mysql-5.7.6-m16_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f37c520a5c9 in raise () from /lib64/libc.so.6
#5  0x00007f37c520bcd8 in abort () from /lib64/libc.so.6
#6  0x00007f37c5203536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f37c52035e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000c4856a in Item_type_holder::get_full_info (this=0x7f37224a5110, item=0x7f37224a4f68) at /bzr/mysql-5.7.6-m16_dbg/sql/item.cc:9820
#9  0x0000000000c475bf in Item_type_holder::Item_type_holder (this=0x7f37224a5110, thd=0x7f372241a000, item=0x7f37224a4f68) at /bzr/mysql-5.7.6-m16_dbg/sql/item.cc:9472
#10 0x000000000114f462 in st_select_lex_unit::prepare (this=0x7f37224a0978, thd_arg=0x7f372241a000, sel_result=0x7f37224a3ea0, added_options=0, removed_options=0) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_union.cc:514
#11 0x00000000010590bb in TABLE_LIST::resolve_derived (this=0x7f37224a4598, thd=0x7f372241a000, apply_semijoin=true) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_derived.cc:69
#12 0x00000000010e9721 in st_select_lex::resolve_derived (this=0x7f372242c110, thd=0x7f372241a000, apply_semijoin=true) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_resolver.cc:832
#13 0x00000000010e78ed in st_select_lex::prepare (this=0x7f372242c110, thd=0x7f372241a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_resolver.cc:132
#14 0x00000000010f303f in handle_query (thd=0x7f372241a000, lex=0x7f372241c068, result=0x7f37224a3e78, added_options=0, removed_options=0) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_select.cc:128
#15 0x00000000010a9e05 in execute_sqlcom_select (thd=0x7f372241a000, all_tables=0x7f37224a4598) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:4697
#16 0x00000000010a3aa0 in mysql_execute_command (thd=0x7f372241a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:2450
#17 0x00000000010aae7a in mysql_parse (thd=0x7f372241a000, parser_state=0x7f37c6bfde00) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:5129
#18 0x00000000010a0bd4 in dispatch_command (command=COM_QUERY, thd=0x7f372241a000, packet=0x7f3722446011 "EXPLAIN PARTITIONS SELECT * FROM(SELECT * FROM (SELECT * FROM t1 WHERE a IN (0,1,13,4)) t1 UNION SELECT * FROM t1) t4", packet_length=117) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:1249
#19 0x000000000109f925 in do_command (thd=0x7f372241a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:835
#20 0x00000000011c2fd9 in handle_connection (arg=0x7f37bd3f78c0) at /bzr/mysql-5.7.6-m16_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#21 0x00000000013d2299 in pfs_spawn_thread (arg=0x7f37be3b2d50) at /bzr/mysql-5.7.6-m16_dbg/storage/perfschema/pfs.cc:2147
#22 0x00007f37c6601df3 in start_thread () from /lib64/libpthread.so.0
#23 0x00007f37c52cb1ad in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create table t1(a enum('','?????')character set utf8mb4);
EXPLAIN PARTITIONS SELECT * FROM(SELECT * FROM (SELECT * FROM t1 WHERE a IN (0,1,13,4)) t1 UNION SELECT * FROM t1) t4;
[23 Mar 2015 7:01] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that only 5.7.6 debug build is affected and not repeatable with 5.6.25,5.7.8 and 5.8.0. This is duplicate of Shane's internal Bug 20456178 which is fixed in 5.7.7.

Thanks,
Umesh
[23 Mar 2015 7:01] MySQL Verification Team
// 5.7.6 only debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76438 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76438 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.6/76438/log.err 2>&1 &

- build

commit: e1298eb6a8e2247361533811930a07fde7aff618
date: 2015-02-26 15:29:31 +0100
build-date: 2015-02-26 15:35:58 +0100
short: e1298eb
branch: mysql-5.7.6-m16-release

MySQL source 5.7.6

(gdb) bt
#0  0x00007f5d2afee771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013ee069 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/mysys/stacktrace.c:247
#2  0x0000000000bdeba0 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f5d29bf45c9 in raise () from /lib64/libc.so.6
#5  0x00007f5d29bf5cd8 in abort () from /lib64/libc.so.6
#6  0x00007f5d29bed536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f5d29bed5e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000c70f22 in Item_type_holder::get_full_info (this=0x7f5cb401afc0, item=0x7f5cb401ae18) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/item.cc:9826
#9  0x0000000000c6ff41 in Item_type_holder::Item_type_holder (this=0x7f5cb401afc0, thd=0x7f5cb4000bb0, item=0x7f5cb401ae18)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/item.cc:9472
#10 0x000000000119001c in st_select_lex_unit::prepare (this=0x7f5cb4040de8, thd_arg=0x7f5cb4000bb0, sel_result=0x7f5cb4044310, added_options=0, removed_options=0)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_union.cc:514
#11 0x0000000001095cf2 in TABLE_LIST::resolve_derived (this=0x7f5cb401a448, thd=0x7f5cb4000bb0, apply_semijoin=true)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_derived.cc:69
#12 0x000000000112832f in st_select_lex::resolve_derived (this=0x7f5cb4005310, thd=0x7f5cb4000bb0, apply_semijoin=true)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_resolver.cc:832
#13 0x000000000112645b in st_select_lex::prepare (this=0x7f5cb4005310, thd=0x7f5cb4000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_resolver.cc:132
#14 0x0000000001131f45 in handle_query (thd=0x7f5cb4000bb0, lex=0x7f5cb4002a90, result=0x7f5cb40442e8, added_options=0, removed_options=0)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_select.cc:128
#15 0x00000000010e8a88 in execute_sqlcom_select (thd=0x7f5cb4000bb0, all_tables=0x7f5cb401a448) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:4697
#16 0x00000000010e1c54 in mysql_execute_command (thd=0x7f5cb4000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:2450
#17 0x00000000010e9a6f in mysql_parse (thd=0x7f5cb4000bb0, parser_state=0x7f5d208185d0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:5129
#18 0x00000000010debc8 in dispatch_command (command=COM_QUERY, thd=0x7f5cb4000bb0,
    packet=0x7f5cb4009ce1 "EXPLAIN PARTITIONS SELECT * FROM(SELECT * FROM (SELECT * FROM t1 WHERE a IN (0,1,13,4)) t1 UNION SELECT * FROM t1) t4", packet_length=117)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:1249
#19 0x00000000010dd693 in do_command (thd=0x7f5cb4000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:835
#20 0x000000000120444f in handle_connection (arg=0x3cadec0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#21 0x00000000017770f1 in pfs_spawn_thread (arg=0x3cd96f0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/perfschema/pfs.cc:2147
#22 0x00007f5d2afe9df3 in start_thread () from /lib64/libpthread.so.0
#23 0x00007f5d29cb547d in clone () from /lib64/libc.so.6
(gdb)
[23 Mar 2015 7:07] MySQL Verification Team
// 5.7.8, 5.8.0 and 5.6.25 not affected(tried debug and opt build)