Bug #59513 Failing assertion: prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE
Submitted: 14 Jan 2011 19:08 Modified: 11 Feb 2011 7:05
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.6.2 OS:Any
Assigned to: CPU Architecture:Any

[14 Jan 2011 19:08] Shane Bester
Description:
Version: '5.6.2-m5-valgrind-max-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
110114 21:02:13  InnoDB: Assertion failure in thread 139761722808080 in file ./storage/innobase/row/row0sel.c line 3869
InnoDB: Failing assertion: prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE

Program terminated with signal 6, Aborted.
#0  0x00000030e14329a5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0  in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  in abort () at abort.c:92
#2  in row_search_for_mysql at ./storage/innobase/row/row0sel.c:3869
#3  in ha_innobase::general_fetch at ./storage/innobase/handler/ha_innodb.cc:6325
#4  in ha_innobase::rnd_next at ./storage/innobase/handler/ha_innodb.cc:6519
#5  in handler::ha_rnd_next at ./sql/handler.cc:2225
#6  in rr_sequential at ./sql/records.cc:458
#7  in JOIN_CACHE_BNL::join_matching_records at ./sql/sql_join_cache.cc:1805
#8  in JOIN_CACHE::join_records at ./sql/sql_join_cache.cc:1654
#9  in JOIN_CACHE::join_records at ./sql/sql_join_cache.cc:1700
#10 in sub_select_cache at ./sql/sql_select.cc:17174
#11 in sub_select at ./sql/sql_select.cc:17344
#12 in do_select at ./sql/sql_select.cc:16922
#13 in JOIN::exec at ./sql/sql_select.cc:3331
#14 in subselect_single_select_engine::exec at ./sql/item_subselect.cc:2382
#15 in Item_subselect::exec at ./sql/item_subselect.cc:298
#16 in Item_singlerow_subselect::val_int at ./sql/item_subselect.cc:723
#17 in Item_func_set_user_var::check at ./sql/item_func.cc:4542
#18 in set_var_user::check  at ./sql/set_var.cc:686
#19 in sql_set_variables at ./sql/set_var.cc:568
#20 in mysql_execute_command at ./sql/sql_parse.cc:3097
#21 in mysql_parse at ./sql/sql_parse.cc:5550
#22 in dispatch_command  at ./sql/sql_parse.cc:1078
#23 in do_command at ./sql/sql_parse.cc:815
#24 in do_handle_one_connection at ./sql/sql_connect.cc:748
#25 in handle_one_connection at ./sql/sql_connect.cc:684
#26 in start_thread at pthread_create.c:301
#27 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) frame 2
#2  0x00000000009f0621 in row_search_for_mysql (buf=0x7f1cf801cb40 "\376", mode=1, prebuilt=0x7f1cf801d908, match_mode=0, direction=1) at ./storage/innobase/row/row0sel.c:3869
3869            ut_ad(prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE);
(gdb) p prebuilt->sql_stat_start
$1 = 0
(gdb) p trx->state
$2 = TRX_STATE_NOT_STARTED
(gdb) 

How to repeat:
seen with concurrent subqueries and joins, will provide exact testcase later.
see attached gdb infos.
[14 Jan 2011 19:19] MySQL Verification Team
some infos

Attachment: bug59513_gdb_infos.txt (text/plain), 183.55 KiB.

[12 Sep 2014 1:10] Roel Van de Paar
Seen here also

2014-09-12 00:59:35 16886 [ERROR] /sda/Percona-Server-5.6.20-rel68.0-657.Linux.x86_64-debug/bin/mysqld: Deadlock found when trying to get lock; try restarting transaction
2014-09-12 00:59:35 16886 [ERROR] /sda/Percona-Server-5.6.20-rel68.0-657.Linux.x86_64-debug/bin/mysqld: Sort aborted: Deadlock found when trying to get lock; try restarting transaction
2014-09-12 00:59:38 7f4309c97700  InnoDB: Assertion failure in thread 139925903734528 in file row0sel.cc line 4021
InnoDB: Failing assertion: prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE
[12 Sep 2014 1:23] Roel Van de Paar
A developer may be able to find the issue by core analysis even without testcase. I was not able to reproduce easily either. Uploading core, myqsld used, ldd files, vardir, stacks, error log etc. for analysis.
[12 Sep 2014 2:05] Roel Van de Paar
Uploaded mysql-bug-59513_BUNDLE_160.tar.gz, please analyze
[12 Sep 2014 2:05] Roel Van de Paar
(to SFTP)