Bug #75690 int handler::ha_index_read_map(...) Assertion`inited == INDEX' failed handler.cc
Submitted: 30 Jan 2015 5:51 Modified: 14 Aug 2017 0:32
Reporter: Roel Van de Paar Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.7.5-m15 OS:Any
Assigned to: CPU Architecture:Any

[30 Jan 2015 5:51] Roel Van de Paar
Description:
2015-01-30T05:17:42.899710Z 0 [Note] /sda/MS-mysql-5.7.5-m15-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.5-m15-debug'  socket: '/dev/shm/1422580784/socket.sock'  port: 34103  MySQL Community Server (GPL)
2015-01-30T05:17:42.900020Z 1 [Note] Event Scheduler: scheduler thread started with id 1
mysqld: /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/handler.cc:2720: int handler::ha_index_read_map(uchar*, const uchar*, key_part_map, ha_rkey_function): Assertion`inited == INDEX' failed.
05:17:47 UTC - mysqld got signal 6 ;

Thread 1 (Thread 0x7fadc655b700 (LWP 15688)):
+bt
#0  0x00007fadc60b3771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000e15cd8 in my_write_core (sig=6) at /bzr/testbuild/mysql-5.7.5-m15_dbg/mysys/stacktrace.c:247
#2  0x0000000000822044 in handle_fatal_signal (sig=6) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x00007fadc4cb75c9 in raise () from /lib64/libc.so.6
#5  0x00007fadc4cb8cd8 in abort () from /lib64/libc.so.6
#6  0x00007fadc4cb0536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fadc4cb05e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000881a03 in handler::ha_index_read_map (this=0x7fac6fcf4020, buf=0x7fac6fcf3e70 "\037\f\376\377\n", key=0x7fac6fcf3e5c "\321\354X\333\374\207a\022", keypart_map=18446744073709551615, find_flag=HA_READ_KEY_EXACT) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/handler.cc:2720
#9  0x0000000000b0a5ff in check_unique_constraint (table=0x7fac6fd6d020, hidden_field_count=0) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:3212
#10 0x0000000000bdeb29 in select_union::send_data (this=0x7fac6fcbe020, values=...) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_union.cc:205
#11 0x0000000000b0965e in end_send (join=0x7fac6fcbe0e0, qep_tab=0x7fac6fcab380, end_of_records=false) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:2833
#12 0x0000000000b065dd in evaluate_join_record (join=0x7fac6fcbe0e0, qep_tab=0x7fac6fcab208) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:1606
#13 0x0000000000b05a46 in sub_select (join=0x7fac6fcbe0e0, qep_tab=0x7fac6fcab208, end_of_records=false) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:1269
#14 0x0000000000b05282 in do_select (join=0x7fac6fcbe0e0) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:922
#15 0x0000000000b031ae in JOIN::exec (this=0x7fac6fcbe0e0) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_executor.cc:190
#16 0x0000000000be1295 in st_select_lex_unit::exec (this=0x7fac6fc272e8) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_union.cc:953
#17 0x0000000000bde9d2 in mysql_union (thd=0x7fac6fc1c000, lex=0x7fac6fc1e370, result=0x7fac6fc28ff0, unit=0x7fac6fc272e8, setup_tables_done_option=0) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_union.cc:174
#18 0x0000000000b856fd in handle_select (thd=0x7fac6fc1c000, result=0x7fac6fc28ff0, setup_tables_done_option=0) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_select.cc:84
#19 0x0000000000b4edf5 in execute_sqlcom_select (thd=0x7fac6fc1c000, all_tables=0x7fac6fc27f10) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:5028
#20 0x0000000000b47775 in mysql_execute_command (thd=0x7fac6fc1c000) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:2488
#21 0x0000000000b4fcc1 in mysql_parse (thd=0x7fac6fc1c000, parser_state=0x7fadc6559e60) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:5427
#22 0x0000000000b44814 in dispatch_command (command=COM_QUERY, thd=0x7fac6fc1c000, packet=0x7fac6fc56011 "select * FROM t1 union select * FROM t1", packet_length=39) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:1250
#23 0x0000000000b4354d in do_command (thd=0x7fac6fc1c000) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:834
#24 0x0000000000c4d4ce in handle_connection (arg=0x7fac77f31180) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#25 0x0000000000e394b8 in pfs_spawn_thread (arg=0x7fada87f8e10) at /bzr/testbuild/mysql-5.7.5-m15_dbg/storage/perfschema/pfs.cc:2137
#26 0x00007fadc60aedf3 in start_thread () from /lib64/libpthread.so.0
#27 0x00007fadc4d781ad in clone () from /lib64/libc.so.6

How to repeat:
$ vi {epoch}_mybase     # Update base path in this file (the only change required!)
$ ./{epoch}_init        # Initializes the data dir
$ ./{epoch}_start       # Starts mysqld
$ ./{epoch}_cl          # To check mysqld is up
$ ./{epoch}_run         # Run the testcase (produces output)
$ vi /dev/shm/{epoch}/error.log.out  # Verify the error log
$ ./{epoch}_gdb         # Brings you to a gdb prompt
$ ./{epoch}_parse_core  # Create {epoch}_STD.gdb and {epoch}_FULL.gdb; standard and full var gdb stack traces
[30 Jan 2015 5:51] Roel Van de Paar
Tarball with all scripts required

Attachment: 1422580784_bug_bundle.tar.gz (application/gzip, text), 93.61 KiB.

[30 Jan 2015 5:52] Roel Van de Paar
.
[28 Mar 2015 12:14] MySQL Verification Team
Testcase:
----------
drop table if exists t1;
create table t1(
a varchar(128),
b bigint,c bigint,d bigint,e bigint,f bigint,g bigint,h bigint,i bigint,
j bigint,k bigint,l bigint,m bigint,n bigint,o bigint,p bigint,q bigint
) engine=innodb;
insert into t1(a)values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
set tmp_table_size=1024;
select * from t1 union select * from t1;
----

Repeatable on 5.7.5 but not 5.7.6+

Version: '5.7.5-m15-debug'  3306  MySQL Community Server - Debug (GPL)
Assertion failed: inited == INDEX, file .\sql\handler.cc, line 2720

mysqld-debug.exe!my_sigabrt_handler()[my_thr_init.c:392]
mysqld-debug.exe!raise()[winsig.c:587]
mysqld-debug.exe!abort()[abort.c:75]
mysqld-debug.exe!_wassert()[assert.c:156]
mysqld-debug.exe!handler::ha_index_read_map()[handler.cc:2720]
mysqld-debug.exe!check_unique_constraint()[sql_executor.cc:3212]
mysqld-debug.exe!select_union::send_data()[sql_union.cc:205]
mysqld-debug.exe!end_send()[sql_executor.cc:2833]
mysqld-debug.exe!evaluate_join_record()[sql_executor.cc:1606]
mysqld-debug.exe!sub_select()[sql_executor.cc:1269]
mysqld-debug.exe!do_select()[sql_executor.cc:922]
mysqld-debug.exe!JOIN::exec()[sql_executor.cc:190]
mysqld-debug.exe!st_select_lex_unit::exec()[sql_union.cc:954]
mysqld-debug.exe!mysql_union()[sql_union.cc:174]
mysqld-debug.exe!handle_select()[sql_select.cc:84]
mysqld-debug.exe!execute_sqlcom_select()[sql_parse.cc:5028]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2488]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5427]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1250]
mysqld-debug.exe!do_command()[sql_parse.cc:834]
mysqld-debug.exe!handle_connection()[connection_handler_per_thread.cc:298]
mysqld-debug.exe!pfs_spawn_thread()[pfs.cc:2137]
mysqld-debug.exe!pthread_start()[my_winthread.c:72]
mysqld-debug.exe!_callthreadstartex()[threadex.c:376]
mysqld-debug.exe!_threadstartex()[threadex.c:359]
[14 Aug 2017 0:32] Roel Van de Paar
Confirmed that the original testcase no longer crashes 5.7.17 too.