Bug #92186 [InnoDB] InnoDB: Assertion failure: trx0trx.h:1326:trx->in_depth > 0
Submitted: 25 Aug 2018 6:25 Modified: 25 Aug 2018 7:27
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.12, 5.7.23 OS:Any
Assigned to: CPU Architecture:Any

[25 Aug 2018 6:25] Roel Van de Paar
Description:
2018-08-25T06:14:20.085467Z 9 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: trx0trx.h:1326:trx->in_depth > 0

Core was generated by `/sda/1/bin/mysqld --no-defaults --core-file --basedir=/sda/1 --tmpdir=/sda/1/da'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7fa9b2234700 (LWP 21810))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000555c3ff9078d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x0000555c3ece4d94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007fa9b2275801 in __GI_abort () at abort.c:79
#6  0x0000555c4037a239 in ut_dbg_assertion_failed (expr=0x555c41533ba8 "trx->in_depth > 0", 
    file=0x555c41533ac0 "/git/MS-8.0.12_dbg/storage/innobase/include/trx0trx.h", line=1326)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x0000555c400dc859 in TrxInInnoDB::exit (trx=0x7fa99c0008d0) at /git/MS-8.0.12_dbg/storage/innobase/include/trx0trx.h:1326
#8  0x0000555c400dc5e7 in TrxInInnoDB::end_stmt (trx=0x7fa99c0008d0) at /git/MS-8.0.12_dbg/storage/innobase/include/trx0trx.h:1259
#9  0x0000555c400d00e6 in ha_innobase::end_stmt (this=0x7fa98a278028)
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:15815
#10 0x0000555c400d0110 in ha_innobase::reset (this=0x7fa98a278028) at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:15826
#11 0x0000555c3ee76650 in handler::ha_reset (this=0x7fa98a278028) at /git/MS-8.0.12_dbg/sql/handler.cc:7457
#12 0x0000555c3ea9d043 in mark_used_tables_as_free_for_reuse (thd=0x7fa98a023000, table=0x7fa98a045e20)
    at /git/MS-8.0.12_dbg/sql/sql_base.cc:1349
#13 0x0000555c3ea9d7ea in close_thread_tables (thd=0x7fa98a023000) at /git/MS-8.0.12_dbg/sql/sql_base.cc:1603
#14 0x0000555c3eb3c487 in mysql_execute_command (thd=0x7fa98a023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4357
#15 0x0000555c3eb3df94 in mysql_parse (thd=0x7fa98a023000, parser_state=0x7fa9b2233330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#16 0x0000555c3eb33aeb in dispatch_command (thd=0x7fa98a023000, com_data=0x7fa9b2233c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#17 0x0000555c3eb323c6 in do_command (thd=0x7fa98a023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#18 0x0000555c3ecd2678 in handle_connection (arg=0x7fa99fb904c0)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#19 0x0000555c40641422 in pfs_spawn_thread (arg=0x7fa9a5be7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#20 0x00007fa9b3c616db in start_thread (arg=0x7fa9b2234700) at pthread_create.c:463
#21 0x00007fa9b235688f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# mysqld options required for replay:  --binlog_format=STATEMENT
CREATE DATABASE test;
USE test;
set session transaction isolation level read committed;
set optimizer_switch='batched_key_access=on,block_nested_loop=off,mrr_cost_based=off';
create TABLE t1(c0 int,c1 int,c2 int,c3 int,c4 int,c5 int,primary key (c0),unique key using hash (c2,c5));
LOCK TABLE t1 WRITE;
SELECT * FROM t1 WHERE c2='2010-10-01 00:00:00' ORDER BY c2;  # May need to wait a few seconds
SELECT * FROM t1 WHERE c2='2010-10-01 00:00:00' ORDER BY c2;
[25 Aug 2018 7:27] MySQL Verification Team
Hello Roel,

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

regards,
Umesh