Bug #86173 Assertion `bit < map->n_bits' failed in bitmap_is_set in include/my_bitmap.h:101
Submitted: 4 May 2017 3:55 Modified: 4 May 2017 4:51
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:5.7.17, 5.7.18 OS:Any
Assigned to: CPU Architecture:Any

[4 May 2017 3:55] Roel Van de Paar
Description:
Version: '5.7.17-debug'  socket: '/sda/MS010217-mysql-5.7.17-linux-x86_64-debug/socket.sock'  port: 18388  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/include/my_bitmap.h:101: my_bool bitmap_is_set(const MY_BITMAP*, uint): Assertion `bit < map->n_bits' failed.
03:26:44 UTC - mysqld got signal 6 ;

#0  0x00007f63cf14b741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000001826d71 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:249
#2  0x0000000000e75574 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f63cd4df1d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f63cd4e08c8 in __GI_abort () at abort.c:90
#6  0x00007f63cd4d8146 in __assert_fail_base (fmt=0x7f63cd6293a8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x1d8d4aa "bit < map->n_bits", file=file@entry=0x1d8d480 "/git/mysql-server_dbg/include/my_bitmap.h", 
    line=line@entry=101, 
    function=function@entry=0x1d8f360 <_ZZ13bitmap_is_setE19__PRETTY_FUNCTION__> "my_bool bitmap_is_set(const MY_BITMAP*, uint)")
    at assert.c:92
#7  0x00007f63cd4d81f2 in __GI___assert_fail (assertion=0x1d8d4aa "bit < map->n_bits", 
    file=0x1d8d480 "/git/mysql-server_dbg/include/my_bitmap.h", line=101, 
    function=0x1d8f360 <_ZZ13bitmap_is_setE19__PRETTY_FUNCTION__> "my_bool bitmap_is_set(const MY_BITMAP*, uint)") at assert.c:101
#8  0x0000000000f7b008 in bitmap_is_set (map=0x7f639185bb68, bit=1) at /git/mysql-server_dbg/include/my_bitmap.h:101
#9  0x0000000000f7de09 in Item_func::contributes_to_filter (this=0x7f63918c4030, read_tables=18446744073709551614, 
    filter_for_table=1, fields_to_ignore=0x7f639185bb68) at /git/mysql-server_dbg/sql/item_func.cc:908
#10 0x0000000000f474d9 in Item_func_eq::get_filtering_effect (this=0x7f63918c4030, filter_for_table=1, 
    read_tables=18446744073709551614, fields_to_ignore=0x7f639185bb68, rows_in_table=1)
    at /git/mysql-server_dbg/sql/item_cmpfunc.cc:7916
#11 0x0000000000f41f5c in Item_cond_and::get_filtering_effect (this=0x7f63918bfe88, filter_for_table=1, 
    read_tables=18446744073709551614, fields_to_ignore=0x7f639185bb68, rows_in_table=1)
    at /git/mysql-server_dbg/sql/item_cmpfunc.cc:6125
#12 0x0000000001513145 in calculate_condition_filter (tab=0x7f63918c4e00, keyuse=0x0, used_tables=18446744073709551614, fanout=1, 
    is_join_buffering=false) at /git/mysql-server_dbg/sql/sql_planner.cc:1403
#13 0x0000000001512688 in Optimize_table_order::best_access_path (this=0x7f63cf73bd50, tab=0x7f63918c4e00, remaining_tables=1, 
    idx=0, disable_jbuf=true, prefix_rowcount=1, pos=0x7f63918c4f98) at /git/mysql-server_dbg/sql/sql_planner.cc:1113
#14 0x0000000001515c34 in Optimize_table_order::best_extension_by_limited_search (this=0x7f63cf73bd50, remaining_tables=1, idx=0, 
    current_search_depth=62) at /git/mysql-server_dbg/sql/sql_planner.cc:2635
#15 0x0000000001514c04 in Optimize_table_order::greedy_search (this=0x7f63cf73bd50, remaining_tables=1)
    at /git/mysql-server_dbg/sql/sql_planner.cc:2226
#16 0x0000000001514441 in Optimize_table_order::choose_table_order (this=0x7f63cf73bd50)
    at /git/mysql-server_dbg/sql/sql_planner.cc:1903
#17 0x00000000014d9acf in JOIN::make_join_plan (this=0x7f63918c4a18) at /git/mysql-server_dbg/sql/sql_optimizer.cc:5069
#18 0x00000000014ce412 in JOIN::optimize (this=0x7f63918c4a18) at /git/mysql-server_dbg/sql/sql_optimizer.cc:368
#19 0x0000000001545f7c in st_select_lex::optimize (this=0x7f63918be138, thd=0x7f6391819000)
    at /git/mysql-server_dbg/sql/sql_select.cc:1009
#20 0x00000000015a4f5c in st_select_lex_unit::optimize (this=0x7f63918be418, thd=0x7f6391819000)
    at /git/mysql-server_dbg/sql/sql_union.cc:686
#21 0x0000000001545fd8 in st_select_lex::optimize (this=0x7f639182b0c0, thd=0x7f6391819000)
    at /git/mysql-server_dbg/sql/sql_select.cc:1015
#22 0x00000000015446d8 in handle_query (thd=0x7f6391819000, lex=0x7f639181b2f8, result=0x7f63918bf580, added_options=0, 
    removed_options=0) at /git/mysql-server_dbg/sql/sql_select.cc:164
#23 0x00000000014fa6e6 in execute_sqlcom_select (thd=0x7f6391819000, all_tables=0x7f639182c9f8)
    at /git/mysql-server_dbg/sql/sql_parse.cc:5195
#24 0x00000000014f3df9 in mysql_execute_command (thd=0x7f6391819000, first_level=true)
    at /git/mysql-server_dbg/sql/sql_parse.cc:2794
#25 0x00000000014fb5f5 in mysql_parse (thd=0x7f6391819000, parser_state=0x7f63cf73d550)
    at /git/mysql-server_dbg/sql/sql_parse.cc:5611
#26 0x00000000014f0c1d in dispatch_command (thd=0x7f6391819000, com_data=0x7f63cf73dcb0, command=COM_QUERY)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1461
#27 0x00000000014efa44 in do_command (thd=0x7f6391819000) at /git/mysql-server_dbg/sql/sql_parse.cc:999
#28 0x000000000161f9d0 in handle_connection (arg=0x7f63a47ec860)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#29 0x00000000018534f9 in pfs_spawn_thread (arg=0x7f63b2e76220) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2188
#30 0x00007f63cf146dc5 in start_thread (arg=0x7f63cf73e700) at pthread_create.c:308
#31 0x00007f63cd5a173d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE transforms;CREATE DATABASE transforms;DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t2 (b DOUBLE);#NOERROR
create TABLE t1 (a int) partition by key (a) (partition p1 );#NOERROR
CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20)) SELECT * FROM t1 ;#NOERROR
SELECT a, b FROM t1 HAVING a IN ( SELECT a FROM t2 WHERE b = t1.b ); ;
[4 May 2017 4:51] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.7.18 debug build is affected.

Thanks,
Umesh