Bug #74780 Assertion `tab->ref.use_count' failed in join_read_key_unlock_row
Submitted: 11 Nov 2014 9:15 Modified: 11 Nov 2014 9:31
Reporter: Ramesh Sivaraman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.20-debug, 5.6.23, 5.7.6 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any

[11 Nov 2014 9:15] Ramesh Sivaraman
Description:
mysqld: /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:2076: void join_read_key_unlock_row(st_join_table*): Assertion `tab->ref.use_count' fai
led.
09:11:38 UTC - mysqld got signal 6 ;

** GDB
#0  0x00007fd4a3dd4771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a9035e in my_write_core (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000723688 in handle_fatal_signal (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007fd4a2be05c9 in raise () from /lib64/libc.so.6
#5  0x00007fd4a2be1cd8 in abort () from /lib64/libc.so.6
#6  0x00007fd4a2bd9536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fd4a2bd95e2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000007a2276 in join_read_key_unlock_row (tab=0x7fd407890318) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:2076
#9  0x00000000007a1360 in evaluate_join_record (join=0x7fd40787d010, join_tab=0x7fd407890318) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:1655
#10 0x00000000007a0738 in sub_select (join=0x7fd40787d010, join_tab=0x7fd407890318, end_of_records=false) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:1276
#11 0x00000000007a1156 in evaluate_join_record (join=0x7fd40787d010, join_tab=0x7fd407890018) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:1601
#12 0x00000000007a0738 in sub_select (join=0x7fd40787d010, join_tab=0x7fd407890018, end_of_records=false) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:1276
#13 0x00000000007a0005 in do_select (join=0x7fd40787d010) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:933
#14 0x000000000079df61 in JOIN::exec (this=0x7fd40787d010) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_executor.cc:194
#15 0x00000000007fe143 in mysql_execute_select (thd=0x7fd410b24000, select_lex=0x7fd410b26878, free_join=true) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:1100
#16 0x00000000007fe43f in mysql_select (thd=0x7fd410b24000, tables=0x7fd40781f3a8, wild_num=0, fields=..., conds=0x7fd407820b68, order=0x7fd410b26a40, group=0x7fd410b26978, having=0x0, select_options=2147748608, result=0x7fd407820da0, unit=0x7fd410b26230, select_lex=0x7fd410b26878) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:1221
#17 0x00000000007fc4c7 in handle_select (thd=0x7fd410b24000, result=0x7fd407820da0, setup_tables_done_option=0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:110
#18 0x00000000007d681b in execute_sqlcom_select (thd=0x7fd410b24000, all_tables=0x7fd40781f3a8) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:5103
#19 0x00000000007cf5cb in mysql_execute_command (thd=0x7fd410b24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:2649
#20 0x00000000007d8fa4 in mysql_parse (thd=0x7fd410b24000, rawbuf=0x7fd40781f010 "SELECT t1.c1,t3.c1 FROM t1 RIGHT JOIN t3 ON t1.c1 =t3.c1 WHERE t1.c1 >=5", length=72, parser_state=0x7fd4a43cbe70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6245
#21 0x00000000007cc557 in dispatch_command (command=COM_QUERY, thd=0x7fd410b24000, packet=0x7fd410b62001 "", packet_length=72) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#22 0x00000000007cb646 in do_command (thd=0x7fd410b24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#23 0x0000000000793a61 in do_handle_one_connection (thd_arg=0x7fd410b24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#24 0x000000000079354a in handle_one_connection (arg=0x7fd410b24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#25 0x0000000000ad4b5c in pfs_spawn_thread (arg=0x7fd4a03feb00) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#26 0x00007fd4a3dcfdf3 in start_thread () from /lib64/libpthread.so.0
#27 0x00007fd4a2ca101d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
SET storage_engine=ARCHIVE;
CREATE TABLE t1(c1 BIGINT NOT NULL AUTO_INCREMENT KEY);
insert delayed into t1 values (1);
INSERT INTO t1 VALUES(0xA7C6);
CREATE TABLE t3(c1 MEDIUMINT NOT NULL);
INSERT INTO t3 VALUES (1),(2),(3);
SELECT t1.c1,t3.c1 FROM t1 RIGHT JOIN t3 ON t1.c1 =t3.c1 WHERE t1.c1 >=5;
[11 Nov 2014 9:31] MySQL Verification Team
Hello Ramesh Sivaraman,

Thank you for the bug report and test case.
Observed that 5.6.23/5.6.7 debug builds affected.

Thanks,
Umesh
[11 Nov 2014 9:31] MySQL Verification Team
// 5.6.23 debug build

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000affdab in my_write_core (sig=6) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/mysys/stacktrace.c:422
#2  0x000000000077ebbc in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x101d7a5 "tab->ref.use_count",
    file=0x101d2c8 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x101d7a5 "tab->ref.use_count", file=0x101d2c8 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc",
    line=2076, function=0x101e480 "void join_read_key_unlock_row(st_join_table*)") at assert.c:105
#8  0x00000000007ffaec in join_read_key_unlock_row (tab=0x7fda600c5848) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:2076
#9  0x00000000007febb1 in evaluate_join_record (join=0x7fda600c3550, join_tab=0x7fda600c5848) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:1655
#10 0x00000000007fde7d in sub_select (join=0x7fda600c3550, join_tab=0x7fda600c5848, end_of_records=false)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:1276
#11 0x00000000007fe947 in evaluate_join_record (join=0x7fda600c3550, join_tab=0x7fda600c5548) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:1601
#12 0x00000000007fde7d in sub_select (join=0x7fda600c3550, join_tab=0x7fda600c5548, end_of_records=false)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:1276
#13 0x00000000007fd75a in do_select (join=0x7fda600c3550) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:933
#14 0x00000000007fb60b in JOIN::exec (this=0x7fda600c3550) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_executor.cc:194
#15 0x000000000085d734 in mysql_execute_select (thd=0x302bf30, select_lex=0x302e7a8, free_join=true)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:1100
#16 0x000000000085da4b in mysql_select (thd=0x302bf30, tables=0x7fda60005388, wild_num=0, fields=..., conds=0x7fda60006b48, order=0x302e970, group=0x302e8a8, having=0x0,
    select_options=2147748608, result=0x7fda60006d80, unit=0x302e160, select_lex=0x302e7a8) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:1221
#17 0x000000000085ba57 in handle_select (thd=0x302bf30, result=0x7fda60006d80, setup_tables_done_option=0)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:110
#18 0x0000000000835384 in execute_sqlcom_select (thd=0x302bf30, all_tables=0x7fda60005388) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:5103
#19 0x000000000082dadc in mysql_execute_command (thd=0x302bf30) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:2649
#20 0x0000000000837fa9 in mysql_parse (thd=0x302bf30, rawbuf=0x7fda60004ff0 "SELECT t1.c1,t3.c1 FROM t1 RIGHT JOIN t3 ON t1.c1 =t3.c1 WHERE t1.c1 >=5", length=72, parser_state=0x7fda98cd7680)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:6357
#21 0x000000000082a92b in dispatch_command (command=COM_QUERY, thd=0x302bf30, packet=0x315a7c1 "", packet_length=72)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1332
#22 0x0000000000829990 in do_command (thd=0x302bf30) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1034
#23 0x00000000007f0d8f in do_handle_one_connection (thd_arg=0x302bf30) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:982
#24 0x00000000007f0860 in handle_one_connection (arg=0x302bf30) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:898
#25 0x0000000000e5f509 in pfs_spawn_thread (arg=0x311def0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/perfschema/pfs.cc:1860
#26 0x0000003deb0079d1 in start_thread (arg=0x7fda98cd8700) at pthread_create.c:301
#27 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[11 Nov 2014 9:31] MySQL Verification Team
// 5.7.6 debug build ( update storage_engine with default_storage_engine in test case)

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000f990a1 in my_write_core (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/mysys/stacktrace.c:247
#2  0x000000000092d7cc in handle_fatal_signal (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x15d155d "tab->ref().use_count",
    file=0x15d10d0 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x15d155d "tab->ref().use_count", file=0x15d10d0 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc",
    line=2075, function=0x15d25c0 "void join_read_key_unlock_row(QEP_TAB*)") at assert.c:105
#8  0x0000000000c72ef9 in join_read_key_unlock_row (tab=0x7f83b803d3c0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:2075
#9  0x0000000000c71f1f in evaluate_join_record (join=0x7f83b803b448, qep_tab=0x7f83b803d3c0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:1662
#10 0x0000000000c710cf in sub_select (join=0x7f83b803b448, qep_tab=0x7f83b803d3c0, end_of_records=false)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:1269
#11 0x0000000000c71c88 in evaluate_join_record (join=0x7f83b803b448, qep_tab=0x7f83b803d248) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:1606
#12 0x0000000000c710cf in sub_select (join=0x7f83b803b448, qep_tab=0x7f83b803d248, end_of_records=false)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:1269
#13 0x0000000000c70914 in do_select (join=0x7f83b803b448) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:922
#14 0x0000000000c6e7d8 in JOIN::exec (this=0x7f83b803b448) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_executor.cc:190
#15 0x0000000000cf4b11 in mysql_select (thd=0x7f83b8000cf0, fields=..., select_options=2147748608, result=0x7f83b80073e8, select_lex=0x7f83b80054f0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_select.cc:1058
#16 0x0000000000cf2f6f in handle_select (thd=0x7f83b8000cf0, result=0x7f83b80073e8, setup_tables_done_option=0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_select.cc:97
#17 0x0000000000cbbfbc in execute_sqlcom_select (thd=0x7f83b8000cf0, all_tables=0x7f83b8006aa8) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:4998
#18 0x0000000000cb4078 in mysql_execute_command (thd=0x7f83b8000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:2487
#19 0x0000000000cbce6a in mysql_parse (thd=0x7f83b8000cf0, parser_state=0x7f83f1455660) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:5397
#20 0x0000000000cb0f2c in dispatch_command (command=COM_QUERY, thd=0x7f83b8000cf0, packet=0x7f83b8009a21 "", packet_length=72)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:1249
#21 0x0000000000cafbd4 in do_command (thd=0x7f83b8000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:833
#22 0x0000000000dbe89c in handle_connection (arg=0x3b97870) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#23 0x000000000138347f in pfs_spawn_thread (arg=0x39ede90) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137
#24 0x0000003deb0079d1 in start_thread (arg=0x7f83f1456700) at pthread_create.c:301
#25 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[26 Oct 2016 9:09] MySQL Verification Team
see http://bugs.mysql.com/bug.php?id=83541
[18 Nov 2016 6:33] Erlend Dahl
Bug#83541 Assertion `tab->ref().use_count' failed. 

was marked as a duplicate.