Bug #92069 InnoDB: Assertion failure: lock0lock.cc:7034 in DeadlockChecker::search
Submitted: 19 Aug 2018 22:08 Modified: 13 Nov 2018 23:49
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[19 Aug 2018 22:08] Roel Van de Paar
Description:
2018-08-19T22:04:29.854649Z 9 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: lock0lock.cc:7034
InnoDB: thread 140219899631360

Core was generated by `/sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
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 0x7f877d4ed700 (LWP 1168))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000563e71d5778d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x0000563e70aabd94 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  0x00007f877d52e801 in __GI_abort () at abort.c:79
#6  0x0000563e72141239 in ut_dbg_assertion_failed (expr=0x0, 
    file=0x563e7332b580 "/git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc", line=7034)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x0000563e71f5ed75 in DeadlockChecker::search (this=0x7f877d4e9730)
    at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:7034
#8  0x0000563e71f5f1f0 in DeadlockChecker::check_and_resolve (lock=0x7f8767c1e6d8, trx=0x7f87674008d0)
    at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:7161
#9  0x0000563e71f4ec14 in RecLock::deadlock_check (this=0x7f877d4e9860, lock=0x7f8767c1e6d8)
    at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:1536
#10 0x0000563e71f4f350 in RecLock::add_to_waitq (this=0x7f877d4e9860, wait_for=0x7f8767c1f018, prdt=0x0)
    at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:1650
#11 0x0000563e71f503fe in lock_rec_lock_slow (impl=0, sel_mode=SELECT_ORDINARY, mode=1027, block=0x7f875ce5dca8, heap_no=5, 
    index=0x7f8767c4b838, thr=0x7f874f2aa9e8) at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:1924
#12 0x0000563e71f50809 in lock_rec_lock (impl=false, sel_mode=SELECT_ORDINARY, mode=1027, block=0x7f875ce5dca8, heap_no=5, 
    index=0x7f8767c4b838, thr=0x7f874f2aa9e8) at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:1993
#13 0x0000563e71f5c405 in lock_clust_rec_read_check_and_lock (flags=0, block=0x7f875ce5dca8, rec=0x7f875e1c413c "testt1", 
    index=0x7f8767c4b838, offsets=0x7f877d4e9fc0, sel_mode=SELECT_ORDINARY, mode=LOCK_X, gap_mode=1024, thr=0x7f874f2aa9e8)
    at /git/MS-8.0.12_dbg/storage/innobase/lock/lock0lock.cc:6108
#14 0x0000563e7208b7fc in sel_set_rec_lock (pcur=0x7f874f2aa2f0, rec=0x7f875e1c413c "testt1", index=0x7f8767c4b838, 
    offsets=0x7f877d4e9fc0, sel_mode=SELECT_ORDINARY, mode=3, type=1024, thr=0x7f874f2aa9e8, mtr=0x7f877d4ea600)
    at /git/MS-8.0.12_dbg/storage/innobase/row/row0sel.cc:1174
#15 0x0000563e720958dc in row_search_mvcc (buf=0x7f874f0e4f28 "\003sysql", mode=PAGE_CUR_G, prebuilt=0x7f874f2aa0b8, match_mode=0, 
    direction=1) at /git/MS-8.0.12_dbg/storage/innobase/row/row0sel.cc:5044
#16 0x0000563e71e857a5 in ha_innobase::general_fetch (this=0x7f874f2a8028, buf=0x7f874f0e4f28 "\003sysql", direction=1, 
    match_mode=0) at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:8886
#17 0x0000563e71e85d51 in ha_innobase::rnd_next (this=0x7f874f2a8028, buf=0x7f874f0e4f28 "\003sysql")
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:9061
#18 0x0000563e70c2fa44 in handler::ha_rnd_next (this=0x7f874f2a8028, buf=0x7f874f0e4f28 "\003sysql")
    at /git/MS-8.0.12_dbg/sql/handler.cc:2800
#19 0x0000563e70818e52 in rr_sequential (info=0x7f874f27c738) at /git/MS-8.0.12_dbg/sql/records.cc:513
#20 0x0000563e70e96e1e in sub_select (join=0x7f874f27be00, qep_tab=0x7f874f27c6e8, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1514
#21 0x0000563e70e96515 in do_select (join=0x7f874f27be00) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1171
#22 0x0000563e70e93621 in JOIN::exec (this=0x7f874f27be00) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:294
#23 0x0000563e70960a30 in Sql_cmd_dml::execute_inner (this=0x7f874f27b448, thd=0x7f874f054000)
    at /git/MS-8.0.12_dbg/sql/sql_select.cc:651
#24 0x0000563e709604bd in Sql_cmd_dml::execute (this=0x7f874f27b448, thd=0x7f874f054000) at /git/MS-8.0.12_dbg/sql/sql_select.cc:554
#25 0x0000563e70902a19 in mysql_execute_command (thd=0x7f874f054000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#26 0x0000563e70904f94 in mysql_parse (thd=0x7f874f054000, parser_state=0x7f877d4ec330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#27 0x0000563e708faaeb in dispatch_command (thd=0x7f874f054000, com_data=0x7f877d4ecc90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#28 0x0000563e708f93c6 in do_command (thd=0x7f874f054000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#29 0x0000563e70a99678 in handle_connection (arg=0x7f876afbb480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#30 0x0000563e72408422 in pfs_spawn_thread (arg=0x7f8770fe7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#31 0x00007f877ef1a6db in start_thread (arg=0x7f877d4ed700) at pthread_create.c:463
#32 0x00007f877d60f88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t1(f1 INT KEY,f2 INT);
INSERT INTO t1 VALUES(2,2);
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
xa start 'test1';
SELECT table_name FROM mysql.innodb_table_stats WHERE table_name='innodb_stats_drop_locked';
INSERT INTO t1 VALUES(1,2);
SELECT * FROM mysql.innodb_table_stats FOR UPDATE;
[20 Aug 2018 4:32] MySQL Verification Team
Hello Roel,

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

regards,
Umesh
[20 Aug 2018 4:35] MySQL Verification Team
- 5.7.23 release/debug build not affected with provided test case
[13 Nov 2018 23:49] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.14 release, and here's the changelog entry:

Deadlock handling for background transactions that involve the
mysql.innodb_table_stats and mysql.innodb_index_stats tables was modified.
The tables were incorrectly included in an assertion that is triggered
when internal tables are included in a deadlock cycle.