Bug #88805 Assertion `item_in->left_expr->cols() == 1' failed.
Submitted: 7 Dec 2017 8:40 Modified: 7 Dec 2017 9:36
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.6.38 OS:Any
Assigned to: CPU Architecture:Any

[7 Dec 2017 8:40] Roel Van de Paar
Description:
Version: '5.6.38-debug'  socket: '/sda/MS071217-mysql-5.6.38-linux-x86_64-debug/socket.sock'  port: 15301  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/item_subselect.cc:3824: virtual bool subselect_hash_sj_engine::exec(): Assertion `item_in->left_expr->cols() == 1' failed.

Core was generated by `/sda/MS071217-mysql-5.6.38-linux-x86_64-debug/bin/mysqld --no-defaults --core -'.
Program terminated with signal 6, Aborted.
#0  0x00007f32baecc9b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61	  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f32baecc9b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000aa0ede in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:424
#2  0x000000000072e9d6 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f32b93ec1f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f32b93ed8e8 in __GI_abort () at abort.c:90
#6  0x00007f32b93e5266 in __assert_fail_base (fmt=0x7f32b9537e68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0xf14440 "item_in->left_expr->cols() == 1", 
    file=file@entry=0xf135d0 "/git/mysql-server_dbg/sql/item_subselect.cc", line=line@entry=3824, 
    function=function@entry=0xf156a0 <subselect_hash_sj_engine::exec()::__PRETTY_FUNCTION__> "virtual bool subselect_hash_sj_engine::exec()") at assert.c:92
#7  0x00007f32b93e5312 in __GI___assert_fail (assertion=0xf14440 "item_in->left_expr->cols() == 1", 
    file=0xf135d0 "/git/mysql-server_dbg/sql/item_subselect.cc", line=3824, 
    function=0xf156a0 <subselect_hash_sj_engine::exec()::__PRETTY_FUNCTION__> "virtual bool subselect_hash_sj_engine::exec()")
    at assert.c:101
#8  0x000000000093f984 in subselect_hash_sj_engine::exec (this=0x7f3276138af8) at /git/mysql-server_dbg/sql/item_subselect.cc:3824
#9  0x0000000000936935 in Item_subselect::exec (this=0x7f3276020df0) at /git/mysql-server_dbg/sql/item_subselect.cc:643
#10 0x0000000000936e16 in Item_in_subselect::exec (this=0x7f3276020df0) at /git/mysql-server_dbg/sql/item_subselect.cc:768
#11 0x0000000000938b62 in Item_in_subselect::val_bool (this=0x7f3276020df0) at /git/mysql-server_dbg/sql/item_subselect.cc:1401
#12 0x000000000064ffdb in Item::val_bool_result (this=0x7f3276020df0) at /git/mysql-server_dbg/sql/item.h:1203
#13 0x000000000067fe76 in Item_in_optimizer::val_int (this=0x7f3276134d68) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:2084
#14 0x000000000065581c in Item::val_bool (this=0x7f3276134d68) at /git/mysql-server_dbg/sql/item.cc:203
#15 0x000000000067b1a0 in Item_func_not::val_int (this=0x7f3276133570) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:290
#16 0x0000000000668866 in Item::send (this=0x7f3276133570, protocol=0x7f32933d64d8, buffer=0x7f32bb4beb30)
    at /git/mysql-server_dbg/sql/item.cc:6936
#17 0x000000000072683a in Protocol::send_result_set_row (this=0x7f32933d64d8, row_items=0x7f32933d85f0)
    at /git/mysql-server_dbg/sql/protocol.cc:844
#18 0x0000000000794d31 in select_send::send_data (this=0x7f3276133c60, items=...) at /git/mysql-server_dbg/sql/sql_class.cc:2541
#19 0x00000000007b05a9 in end_send (join=0x7f3276133c88, join_tab=0x7f3276137318, end_of_records=false)
    at /git/mysql-server_dbg/sql/sql_executor.cc:2783
#20 0x00000000007adb02 in evaluate_join_record (join=0x7f3276133c88, join_tab=0x7f3276137018)
    at /git/mysql-server_dbg/sql/sql_executor.cc:1604
#21 0x00000000007ad103 in sub_select (join=0x7f3276133c88, join_tab=0x7f3276137018, end_of_records=false)
    at /git/mysql-server_dbg/sql/sql_executor.cc:1279
#22 0x00000000007ac9e6 in do_select (join=0x7f3276133c88) at /git/mysql-server_dbg/sql/sql_executor.cc:936
#23 0x00000000007aa985 in JOIN::exec (this=0x7f3276133c88) at /git/mysql-server_dbg/sql/sql_executor.cc:194
#24 0x000000000080aab3 in mysql_execute_select (thd=0x7f32933d6000, select_lex=0x7f32933d84d0, free_join=true)
    at /git/mysql-server_dbg/sql/sql_select.cc:1101
#25 0x000000000080ada5 in mysql_select (thd=0x7f32933d6000, tables=0x7f3276133648, wild_num=0, fields=..., conds=0x0, 
    order=0x7f32933d8698, group=0x7f32933d85d0, having=0x0, select_options=2147748608, result=0x7f3276133c60, unit=0x7f32933d7e88, 
    select_lex=0x7f32933d84d0) at /git/mysql-server_dbg/sql/sql_select.cc:1222
#26 0x0000000000808e76 in handle_select (thd=0x7f32933d6000, result=0x7f3276133c60, setup_tables_done_option=0)
    at /git/mysql-server_dbg/sql/sql_select.cc:110
#27 0x00000000007e30a9 in execute_sqlcom_select (thd=0x7f32933d6000, all_tables=0x7f3276133648)
    at /git/mysql-server_dbg/sql/sql_parse.cc:5187
#28 0x00000000007dbe96 in mysql_execute_command (thd=0x7f32933d6000) at /git/mysql-server_dbg/sql/sql_parse.cc:2695
#29 0x00000000007e5bb4 in mysql_parse (thd=0x7f32933d6000, 
    rawbuf=0x7f327601f010 "SELECT(SELECT 1,2 FROM t2)NOT IN (SELECT 1,2 FROM t1) FROM t1", length=61, parser_state=0x7f32bb4c0590)
    at /git/mysql-server_dbg/sql/sql_parse.cc:6439
#30 0x00000000007d8e92 in dispatch_command (command=COM_QUERY, thd=0x7f32933d6000, packet=0x7f32856f0001 "", packet_length=61)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1376
#31 0x00000000007d7ed0 in do_command (thd=0x7f32933d6000) at /git/mysql-server_dbg/sql/sql_parse.cc:1039
#32 0x000000000079f86b in do_handle_one_connection (thd_arg=0x7f329338f000) at /git/mysql-server_dbg/sql/sql_connect.cc:982
#33 0x000000000079f608 in handle_one_connection (arg=0x7f329338f000) at /git/mysql-server_dbg/sql/sql_connect.cc:899
#34 0x0000000000aed28b in pfs_spawn_thread (arg=0x7f32b77f3e80) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:1861
#35 0x00007f32baec7e25 in start_thread (arg=0x7f32bb4c1700) at pthread_create.c:308
#36 0x00007f32b94af34d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
USE test;
create TABLE t1(a int key)ENGINE=InnoDB;
create table t2(a int,b char(16),primary key (a))ENGINE=InnoDB;
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES(9),(7);
INSERT INTO t1 VALUES(0xA8D4);
SELECT(SELECT 1,2 FROM t2)NOT IN (SELECT 1,2 FROM t1) FROM t1;
[7 Dec 2017 9:36] Umesh Shastry
Hello Roel,

Thank you for the report and test case.
Observed that 5.6.38 debug build is affected.
5.5.58/5.7.20 - not affected with provided test case.

Thanks,
Umesh