Bug #79391 InnoDB: Failing assertion: !is_owned() in file sync0policy.ic line 63
Submitted: 24 Nov 2015 4:35 Modified: 10 Dec 2015 7:23
Reporter: Roel Van de Paar Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Information schema Severity:S6 (Debug Builds)
Version:5.7.9 GA OS:Any
Assigned to: CPU Architecture:Any

[24 Nov 2015 4:35] Roel Van de Paar
Description:
2015-11-24 15:23:44 0x7fb1a4381700  InnoDB: Assertion failure in thread 140400941078272 in file sync0policy.ic line 63
InnoDB: Failing assertion: !is_owned()

+bt
#0  0x00007fb1a3d87771 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000001796a78 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:247
#2  0x0000000000e1dc70 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007fb1a298b5d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fb1a298ccc8 in __GI_abort () at abort.c:90
#6  0x0000000001aedf9b in ut_dbg_assertion_failed (expr=0x206d75e "!is_owned()", file=0x206d720 "/git/mysql-server_dbg/storage/innobase/include/sync0policy.ic", line=63) at /git/mysql-server_dbg/storage/innobase/ut/ut0dbg.cc:67
#7  0x00000000018eaa18 in MutexDebug<TTASEventMutex<GenericPolicy> >::enter (this=0x7fb19bbf2030, mutex=0x7fb19bbf2018, name=0x20f2bc0 "/git/mysql-server_dbg/storage/innobase/buf/buf0lru.cc", line=1120) at /git/mysql-server_dbg/storage/innobase/include/sync0policy.ic:63
#8  0x00000000018e9260 in GenericPolicy<TTASEventMutex<GenericPolicy> >::enter (this=0x7fb19bbf2030, mutex=..., filename=0x20f2bc0 "/git/mysql-server_dbg/storage/innobase/buf/buf0lru.cc", line=1120) at /git/mysql-server_dbg/storage/innobase/include/sync0policy.h:347
#9  0x00000000018e7692 in PolicyMutex<TTASEventMutex<GenericPolicy> >::enter (this=0x7fb19bbf2018, n_spins=30, n_delay=6, name=0x20f2bc0 "/git/mysql-server_dbg/storage/innobase/buf/buf0lru.cc", line=1120) at /git/mysql-server_dbg/storage/innobase/include/ib0mutex.h:985
#10 0x0000000001b72aa8 in buf_LRU_buf_pool_running_out () at /git/mysql-server_dbg/storage/innobase/buf/buf0lru.cc:1120
#11 0x00000000019f41c7 in row_ins_sorted_clust_index_entry (mode=33, index=0x7fb0d9077ca0, entry=0x7fb0d90779a0, n_ext=0, thr=0x7fb0d909d960) at /git/mysql-server_dbg/storage/innobase/row/row0ins.cc:2592
#12 0x00000000019f5cf0 in row_ins_clust_index_entry (index=0x7fb0d9077ca0, entry=0x7fb0d90779a0, thr=0x7fb0d909d960, n_ext=0, dup_chk_only=false) at /git/mysql-server_dbg/storage/innobase/row/row0ins.cc:3180
#13 0x0000000001a14a78 in row_insert_for_mysql_using_cursor (mysql_rec=0x7fb0d90a8720 "\377", prebuilt=0x7fb0d909d0a0) at /git/mysql-server_dbg/storage/innobase/row/row0mysql.cc:1570
#14 0x0000000001a1560f in row_insert_for_mysql (mysql_rec=0x7fb0d90a8720 "\377", prebuilt=0x7fb0d909d0a0) at /git/mysql-server_dbg/storage/innobase/row/row0mysql.cc:1828
#15 0x00000000018cc0cd in ha_innobase::intrinsic_table_write_row (this=0x7fb0d90a8430, record=0x7fb0d90a8720 "\377") at /git/mysql-server_dbg/storage/innobase/handler/ha_innodb.cc:7047
#16 0x00000000018cc192 in ha_innobase::write_row (this=0x7fb0d90a8430, record=0x7fb0d90a8720 "\377") at /git/mysql-server_dbg/storage/innobase/handler/ha_innodb.cc:7071
#17 0x0000000000e9ae1b in handler::ha_write_row (this=0x7fb0d90a8430, buf=0x7fb0d90a8720 "\377") at /git/mysql-server_dbg/sql/handler.cc:7764
#18 0x00000000014f3647 in schema_table_store_record (thd=0x7fb0d9019000, table=0x7fb0d908f030) at /git/mysql-server_dbg/sql/sql_show.cc:3092
#19 0x000000000191e944 in i_s_cmpmem_fill_low (thd=0x7fb0d9019000, tables=0x7fb0d902bd00, reset=1) at /git/mysql-server_dbg/storage/innobase/handler/i_s.cc:2123
#20 0x000000000191ea3f in i_s_cmpmem_reset_fill (thd=0x7fb0d9019000, tables=0x7fb0d902bd00, cond=0x0) at /git/mysql-server_dbg/storage/innobase/handler/i_s.cc:2164
#21 0x0000000001504c27 in do_fill_table (thd=0x7fb0d9019000, table_list=0x7fb0d902bd00, qep_tab=0x7fb0d909fc20) at /git/mysql-server_dbg/sql/sql_show.cc:7970
#22 0x000000000150500c in get_schema_tables_result (join=0x7fb0d909f540, executed_place=PROCESSED_BY_JOIN_EXEC) at /git/mysql-server_dbg/sql/sql_show.cc:8072
#23 0x00000000014ddce5 in JOIN::prepare_result (this=0x7fb0d909f540) at /git/mysql-server_dbg/sql/sql_select.cc:909
#24 0x00000000014442e4 in JOIN::exec (this=0x7fb0d909f540) at /git/mysql-server_dbg/sql/sql_executor.cc:124
#25 0x00000000014dc8ba in handle_query (thd=0x7fb0d9019000, lex=0x7fb0d901b2e8, result=0x7fb0d902cb38, added_options=0, removed_options=0) at /git/mysql-server_dbg/sql/sql_select.cc:184
#26 0x0000000001493419 in execute_sqlcom_select (thd=0x7fb0d9019000, all_tables=0x7fb0d902bd00) at /git/mysql-server_dbg/sql/sql_parse.cc:4947
#27 0x000000000148cd3a in mysql_execute_command (thd=0x7fb0d9019000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:2597
#28 0x0000000001494305 in mysql_parse (thd=0x7fb0d9019000, parser_state=0x7fb1a4380670) at /git/mysql-server_dbg/sql/sql_parse.cc:5357
#29 0x0000000001489caa in dispatch_command (thd=0x7fb0d9019000, com_data=0x7fb1a4380dc0, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1284
#30 0x0000000001488b76 in do_command (thd=0x7fb0d9019000) at /git/mysql-server_dbg/sql/sql_parse.cc:852
#31 0x00000000015b2cdb in handle_connection (arg=0x7fb0e13ff240) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:295
#32 0x00000000017c3aa0 in pfs_spawn_thread (arg=0x7fb0f23e7820) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2192
#33 0x00007fb1a3d82df5 in start_thread (arg=0x7fb1a4381700) at pthread_create.c:308
#34 0x00007fb1a2a4c1ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
set big_tables=OFF,big_tables=ON,big_tables=0,big_tables=1,big_tables="OFF",big_tables="ON";
set global innodb_limit_optimistic_insert_debug=2;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
[24 Nov 2015 6:16] Roel Van de Paar
.
[24 Nov 2015 7:55] Roel Van de Paar
.
[24 Nov 2015 8:26] MySQL Verification Team
Hello Roel,

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

Thanks,
Umesh
[24 Nov 2015 8:27] MySQL Verification Team
// 5.7.9
rm -rf 79391
bin/mysql_install_db --insecure --basedir=/export/umesh/server/binaries/mysql-5.7.9 --datadir=/export/umesh/server/binaries/mysql-5.7.9/79391 -v
bin/mysqld-debug --no-defaults --basedir=/export/umesh/server/binaries/mysql-5.7.9 --datadir=/export/umesh/server/binaries/mysql-5.7.9/79391 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-5.7.9/79391/log.err 2>&1 &

[umshastr@hod03]/export/umesh/server/binaries/mysql-5.7.9: bin/mysql  -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.9-debug MySQL Community Server - Debug (GPL)
.
mysql> DROP DATABASE test;CREATE DATABASE test;USE test;
Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Database changed
mysql> set big_tables=OFF,big_tables=ON,big_tables=0,big_tables=1,big_tables="OFF",big_tables="ON";
Query OK, 0 rows affected (0.00 sec)

mysql> set global innodb_limit_optimistic_insert_debug=2;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> \q
Bye
[1]+  Aborted                 (core dumped) bin/mysqld-debug --no-defaults --basedir=/export/umesh/server/binaries/mysql-5.7.9 --datadir=/export/umesh/server/binaries/mysql-5.7.9/79391 --core-file --socket=/tmp/mysql_ushastry.sock --port=15000 --log-error=/export/umesh/server/binaries/mysql-5.7.9/79391/log.err 2>&1
[umshastr@hod03]/export/umesh/server/binaries/mysql-5.7.9:
[umshastr@hod03]/export/umesh/server/binaries/mysql-5.7.9: gdb bin/mysqld-debug 79391/core.15085
.
(gdb) bt
#0  0x00007f17679bb771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000001803885 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/mysys/stacktrace.c:247
#2  0x0000000000e45850 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f17665c15d7 in raise () from /lib64/libc.so.6
#5  0x00007f17665c2cc8 in abort () from /lib64/libc.so.6
#6  0x0000000001b4a31b in ut_dbg_assertion_failed (expr=0x226d058 "!(&buf_pool->mutex)->is_owned()",
    file=0x226d7c8 "/export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/buf/buf0buf.cc", line=3472)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/ut/ut0dbg.cc:67
#7  0x0000000001baca9e in buf_page_make_young_if_needed (bpage=0x7f173b69f790) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/buf/buf0buf.cc:3472
#8  0x0000000001baf7d6 in buf_page_get_gen (page_id=..., page_size=..., rw_latch=8, guess=0x0, mode=10,
    file=0x221d318 "/export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0ins.cc", line=2561, mtr=0x7f16ec0224d0, dirty_with_no_latch=true)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/buf/buf0buf.cc:4634
#9  0x0000000001b79880 in btr_cur_search_to_nth_level_with_no_latch (index=0x7f16ec01c210, level=0, tuple=0x7f16ec01b330, mode=PAGE_CUR_LE, cursor=0x7f173a3c0d00,
    file=0x221d318 "/export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0ins.cc", line=2561, mtr=0x7f16ec0224d0, mark_dirty=true)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/btr/btr0cur.cc:2059
#10 0x0000000001a4c78c in row_ins_sorted_clust_index_entry (mode=2, index=0x7f16ec01c210, entry=0x7f16ec01b330, n_ext=0, thr=0x7f16ec0255a0)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0ins.cc:2561
#11 0x0000000001a4e342 in row_ins_clust_index_entry (index=0x7f16ec01c210, entry=0x7f16ec01b330, thr=0x7f16ec0255a0, n_ext=0, dup_chk_only=false)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0ins.cc:3154
#12 0x0000000001a6d584 in row_insert_for_mysql_using_cursor (mysql_rec=0x7f16ec010810 "\377", prebuilt=0x7f16ec024ce0)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0mysql.cc:1570
#13 0x0000000001a6e179 in row_insert_for_mysql (mysql_rec=0x7f16ec010810 "\377", prebuilt=0x7f16ec024ce0)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/row/row0mysql.cc:1828
#14 0x00000000019235b7 in ha_innobase::intrinsic_table_write_row (this=0x7f16ec010520, record=0x7f16ec010810 "\377")
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/handler/ha_innodb.cc:7047
#15 0x000000000192367e in ha_innobase::write_row (this=0x7f16ec010520, record=0x7f16ec010810 "\377")
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/handler/ha_innodb.cc:7071
#16 0x0000000000ec47ef in handler::ha_write_row (this=0x7f16ec010520, buf=0x7f16ec010810 "\377") at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/handler.cc:7764
#17 0x0000000001550953 in schema_table_store_record (thd=0x7f16ec000b70, table=0x7f16ec00f360) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_show.cc:3092
#18 0x0000000001975769 in i_s_cmpmem_fill_low (thd=0x7f16ec000b70, tables=0x7f16ec006250, reset=1)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/handler/i_s.cc:2123
#19 0x0000000001975884 in i_s_cmpmem_reset_fill (thd=0x7f16ec000b70, tables=0x7f16ec006250, cond=0x0)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/innobase/handler/i_s.cc:2164
#20 0x00000000015629ea in do_fill_table (thd=0x7f16ec000b70, table_list=0x7f16ec006250, qep_tab=0x7f16ec026990)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_show.cc:7970
#21 0x0000000001562dda in get_schema_tables_result (join=0x7f16ec0262b0, executed_place=PROCESSED_BY_JOIN_EXEC)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_show.cc:8072
#22 0x000000000153a49d in JOIN::prepare_result (this=0x7f16ec0262b0) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_select.cc:908
#23 0x000000000149d8d1 in JOIN::exec (this=0x7f16ec0262b0) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_executor.cc:124
#24 0x0000000001539062 in handle_query (thd=0x7f16ec000b70, lex=0x7f16ec002cd0, result=0x7f16ec007088, added_options=0, removed_options=0)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_select.cc:184
#25 0x00000000014eeece in execute_sqlcom_select (thd=0x7f16ec000b70, all_tables=0x7f16ec006250) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_parse.cc:4947
#26 0x00000000014e7b69 in mysql_execute_command (thd=0x7f16ec000b70, first_level=true) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_parse.cc:2597
#27 0x00000000014efd25 in mysql_parse (thd=0x7f16ec000b70, parser_state=0x7f173a3c36a0) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_parse.cc:5357
#28 0x00000000014e4930 in dispatch_command (thd=0x7f16ec000b70, com_data=0x7f173a3c3e10, command=COM_QUERY)
    at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_parse.cc:1284
#29 0x00000000014e37ea in do_command (thd=0x7f16ec000b70) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/sql_parse.cc:852
#30 0x0000000001613d77 in handle_connection (arg=0x4548bb0) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/sql/conn_handler/connection_handler_per_thread.cc:295
#31 0x000000000188fd80 in pfs_spawn_thread (arg=0x4636550) at /export/home/pb2/build/sb_0-16729453-1444633651.02/mysql-5.7.9/storage/perfschema/pfs.cc:2192
#32 0x00007f17679b6df5 in start_thread () from /lib64/libpthread.so.0
#33 0x00007f176668260d in clone () from /lib64/libc.so.6
(gdb)
[24 Nov 2015 8:28] MySQL Verification Team
// 5.6.27 debug/release not affected
[8 Dec 2015 13:54] Laurynas Biveinis
Hasn't this been fixed in 5.7.10?

commit e5771fc559fad274964647a007be466dce4906d0
Author: Debarun Banerjee <debarun.banerjee@oracle.com>
Date:   Wed Sep 23 21:20:26 2015 +0530

    BUG#21871451 INNODB: FAILING ASSERTION: !(&BUF_POOL->MUTEX)
    
    Problem :
    ---------
    While selecting from INFORMATION_SCHEMA.INNODB_CMPMEM with option
    big-tables=1, the fetched rows are filled into temp table by the
    sql function schema_table_store_record().
    
    Innodb i_s_cmpmem_fill_low() calls the record store callback while
    holding buf_pool_mutex. The issue started occurring when we started
    to use InnoDB intrinsic table to store the records instead of heap
    engine. We re-enter InnoDB to insert record into intrinsic table
    while holding buf_pool_mutex and hit ASSERT.
    
    Solution :
    ----------
    Acquire buf_pool_mutex and store records locally and call the store
    callback after releasing buf_pool_mutex.
    
    Reviewed-by: Marko Makela <marko.makela@oracle.com>
    
    RB: 10339
[10 Dec 2015 7:23] Erlend Dahl
Duplicate of Bug#78494 InnoDB: Failing assertion: !(&buf_pool->mutex)->is_owned() buf0buf.cc line 3388