Bug #107207 Assertion Failure buf0buf.cc:4318:page_size.equals_to(space_page_size)
Submitted: 4 May 2022 9:42 Modified: 4 May 2022 10:26
Reporter: Mohit Joshi Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:8.0.25, 8.0.29 OS:Any
Assigned to: CPU Architecture:Any

[4 May 2022 9:42] Mohit Joshi
Description:
MySQL server crashes with the attached MTR testcase. The crash is reproducible on the latest version of MySQL(8.0.29). The crash also occurs on previous versions of MySQL. Checked until 8.0.25

Below is the stack trace:

#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x0000563c24573462 in my_write_core (sig=6) at /home/mohit.joshi/mysql-8.0/mysys/stacktrace.cc:396
#2  0x0000563c23301dd5 in handle_fatal_signal (sig=6) at /home/mohit.joshi/mysql-8.0/sql/signal_handler.cc:225
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f076187a859 in __GI_abort () at abort.c:79
#6  0x0000563c23301f5e in my_server_abort () at /home/mohit.joshi/mysql-8.0/sql/signal_handler.cc:284
#7  0x0000563c24569067 in my_abort () at /home/mohit.joshi/mysql-8.0/mysys/my_init.cc:264
#8  0x0000563c24a4eabe in ut_dbg_assertion_failed (expr=0x563c269f2528 "page_size.equals_to(space_page_size)",
    file=0x563c269f06b0 "/home/mohit.joshi/mysql-8.0/storage/innobase/buf/buf0buf.cc", line=4318) at /home/mohit.joshi/mysql-8.0/storage/innobase/ut/ut0dbg.cc:99
#9  0x0000563c24aff998 in buf_page_get_gen (page_id=..., page_size=..., rw_latch=2, guess=0x0, mode=Page_fetch::PEEK_IF_IN_POOL,
    file=0x563c269e8ee0 "/home/mohit.joshi/mysql-8.0/storage/innobase/btr/btr0sea.cc", line=1271, mtr=0x7f073c260890, dirty_with_no_latch=false)
    at /home/mohit.joshi/mysql-8.0/storage/innobase/buf/buf0buf.cc:4318
#10 0x0000563c24ae5b60 in btr_search_drop_page_hash_when_freed (page_id=..., page_size=...) at /home/mohit.joshi/mysql-8.0/storage/innobase/btr/btr0sea.cc:1270
#11 0x0000563c24ae5f31 in btr_drop_next_batch (page_size=..., first=0x7f073c260ea0, last=0x7f073c260ea8) at /home/mohit.joshi/mysql-8.0/storage/innobase/btr/btr0sea.cc:1337
#12 0x0000563c24ae61d6 in btr_drop_ahi_for_table (table=0x7f06a821e648) at /home/mohit.joshi/mysql-8.0/storage/innobase/btr/btr0sea.cc:1374
#13 0x0000563c24905f5a in row_drop_table_from_cache (table=0x7f06a821e648, trx=0x7f075403d098) at /home/mohit.joshi/mysql-8.0/storage/innobase/row/row0mysql.cc:4158
#14 0x0000563c249072e9 in row_drop_table_for_mysql (name=0x7f073c261910 "test/tt_4", trx=0x7f075403d098, nonatomic=true, handler=0x0)
    at /home/mohit.joshi/mysql-8.0/storage/innobase/row/row0mysql.cc:4556
#15 0x0000563c247018b8 in innobase_basic_ddl::delete_impl<dd::Table> (thd=0x7f06a800abb0, name=0x7f073c263060 "./test/tt_4", dd_tab=0x7f06a8def7b8, td=0x0)
    at /home/mohit.joshi/mysql-8.0/storage/innobase/handler/ha_innodb.cc:15258
#16 0x0000563c246d7960 in ha_innobase::delete_table (this=0x7f06a8e26730, name=0x7f073c263060 "./test/tt_4", table_def=0x7f06a8def7b8)
    at /home/mohit.joshi/mysql-8.0/storage/innobase/handler/ha_innodb.cc:16296
#17 0x0000563c22c23e33 in handler::ha_delete_table (this=0x7f06a8e26730, name=0x7f073c263060 "./test/tt_4", table_def=0x7f06a8def7b8) at /home/mohit.joshi/mysql-8.0/sql/handler.cc:5262
#18 0x0000563c22c1a68e in ha_delete_table (thd=0x7f06a800abb0, table_type=0x563c2adefcc0, path=0x7f073c263060 "./test/tt_4", db=0x7f06a8e231c8 "test", alias=0x7f06a8e22a38 "tt_4",
    table_def=0x7f06a8def7b8, generate_warning=true) at /home/mohit.joshi/mysql-8.0/sql/handler.cc:2706
#19 0x0000563c2319c76d in drop_base_table (thd=0x7f06a800abb0, drop_ctx=..., table=0x7f06a8e22b40, atomic=true, post_ddl_htons=0x7f073c2645d0, fk_invalidator=0x7f073c264600,
    safe_to_release_mdl=0x7f073c263420, foreach_table_root=0x7f073c2634b0) at /home/mohit.joshi/mysql-8.0/sql/sql_table.cc:2951
#20 0x0000563c2319da52 in mysql_rm_table_no_locks (thd=0x7f06a800abb0, tables=0x7f06a8e22b40, if_exists=false, drop_temporary=false, drop_database=false,
    dropped_non_atomic_flag=0x7f073c264551, post_ddl_htons=0x7f073c2645d0, fk_invalidator=0x7f073c264600, safe_to_release_mdl=0x7f073c264580)
    at /home/mohit.joshi/mysql-8.0/sql/sql_table.cc:3330
#21 0x0000563c231994e2 in mysql_rm_table (thd=0x7f06a800abb0, tables=0x7f06a8e22b40, if_exists=false, drop_temporary=false) at /home/mohit.joshi/mysql-8.0/sql/sql_table.cc:1668
#22 0x0000563c230cd683 in mysql_execute_command (thd=0x7f06a800abb0, first_level=true) at /home/mohit.joshi/mysql-8.0/sql/sql_parse.cc:3778
#23 0x0000563c230d30e7 in dispatch_sql_command (thd=0x7f06a800abb0, parser_state=0x7f073c265aa0, update_userstat=false) at /home/mohit.joshi/mysql-8.0/sql/sql_parse.cc:5466
#24 0x0000563c230c82ef in dispatch_command (thd=0x7f06a800abb0, com_data=0x7f073c266b70, command=COM_QUERY) at /home/mohit.joshi/mysql-8.0/sql/sql_parse.cc:2031
#25 0x0000563c230c635b in do_command (thd=0x7f06a800abb0) at /home/mohit.joshi/mysql-8.0/sql/sql_parse.cc:1414
#26 0x0000563c232ea3a8 in handle_connection (arg=0x563c2af13cb0) at /home/mohit.joshi/mysql-8.0/sql/conn_handler/connection_handler_per_thread.cc:308
#27 0x0000563c24e38385 in pfs_spawn_thread (arg=0x563c2b07a0f0) at /home/mohit.joshi/mysql-8.0/storage/perfschema/pfs.cc:2948
#28 0x00007f0761a52609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#29 0x00007f0761977163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
./mtr crash_bug.test
[4 May 2022 9:43] Mohit Joshi
MTR testcase

Attachment: crash_bug.test (application/octet-stream, text), 17.57 KiB.

[4 May 2022 9:43] Mohit Joshi
opt file

Attachment: crash_bug-master.opt (application/octet-stream, text), 123 bytes.

[4 May 2022 10:26] MySQL Verification Team
Hello Mohit,

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

regards,
Umesh
[4 May 2022 10:27] MySQL Verification Team
- 8.0.29 debug build

rm -rf 107207/
rm -rf keyring/
mkdir keyring
bin/mysqld-debug --initialize-insecure --basedir=$PWD --datadir=$PWD/107207 --log-error-verbosity=3
bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/107207 --core-file --socket=/tmp/mysql_ushastry.sock  --port=3306 --log-error=$PWD/107207/log.err --mysqlx-port=33330 --mysqlx-socket=/tmp/mysql_x_ushastry.sock --log-error-verbosity=3  --secure-file-priv=/tmp/ --plugin-dir=$PWD/lib/plugin/debug/ --early-plugin-load='keyring_file.so' --keyring_file_data=$PWD/keyring/keyring 2>&1 &

 bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.29-debug MySQL Community Server - GPL - Debug

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database test;
Query OK, 1 row affected (0.00 sec)

mysql> \q
^[[ABye
[umshastr@support-cluster03:/export/home/tmp/ushastry/mysql-8.0.29]$ bin/mysql -uroot -S /tmp/mysql_ushastry.sock test < mysql-test/t/crash_bug.test
Table   Op      Msg_type        Msg_text
test.tt_4       analyze status  OK
ERROR 2013 (HY000) at line 211: Lost connection to MySQL server during query
[1]+  Aborted                 (core dumped) bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/107207 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/107207/log.err --mysqlx-port=33330 --mysqlx-socket=/tmp/mysql_x_ushastry.sock --log-error-verbosity=3 --secure-file-priv=/tmp/ --plugin-dir=$PWD/lib/plugin/debug/ --early-plugin-load='keyring_file.so' --keyring_file_data=$PWD/keyring/keyring 2>&1

(gdb) bt
#0  0x00007fab70f14aa1 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000004795d5b in my_write_core(int) ()
#2  0x00000000033e3406 in handle_fatal_signal ()
#3  <signal handler called>
#4  0x00007fab6f151387 in raise () from /lib64/libc.so.6
#5  0x00007fab6f152a78 in abort () from /lib64/libc.so.6
#6  0x00000000033e357b in my_server_abort() ()
#7  0x000000000478cfec in my_abort() ()
#8  0x0000000004c080b4 in ut_dbg_assertion_failed(char const*, char const*, unsigned long) ()
#9  0x0000000004cabcfa in buf_page_get_gen(page_id_t const&, page_size_t const&, unsigned long, buf_block_t*, Page_fetch, ut::Location, mtr_t*, bool) ()
#10 0x0000000004c964c4 in btr_search_drop_page_hash_when_freed(page_id_t const&, page_size_t const&) ()
#11 0x0000000004c96858 in btr_drop_next_batch(page_size_t const&, dict_index_t const**, dict_index_t const**) ()
#12 0x0000000004c96a85 in btr_drop_ahi_for_table(dict_table_t*) ()
#13 0x0000000004adbfd4 in row_drop_table_from_cache(dict_table_t*, trx_t*) ()
#14 0x0000000004add138 in row_drop_table_for_mysql(char const*, trx_t*, bool, dict_table_t*) ()
#15 0x0000000004903d60 in int innobase_basic_ddl::delete_impl<dd::Table>(THD*, char const*, dd::Table const*, TABLE const*) ()
#16 0x00000000048de866 in ha_innobase::delete_table(char const*, dd::Table const*) ()
#17 0x000000000357c9e7 in handler::ha_delete_table(char const*, dd::Table const*) ()
#18 0x00000000035743b3 in ha_delete_table(THD*, handlerton*, char const*, char const*, char const*, dd::Table const*, bool) ()
#19 0x00000000032aa9dd in drop_base_table(THD*, Drop_tables_ctx const&, TABLE_LIST*, bool, std::set<handlerton*, std::less<handlerton*>, std::allocator<handlerton*> >*, Foreign_key_parents_invalidator*, std::vector<MDL_ticket*, std::allocator<MDL_ticket*> >*, MEM_ROOT*) ()
#20 0x00000000032abb2b in mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool*, std::set<handlerton*, std::less<handlerton*>, std::allocator<handlerton*> >*, Foreign_key_parents_invalidator*, std::vector<MDL_ticket*, std::allocator<MDL_ticket*> >*) ()
#21 0x00000000032a7b11 in mysql_rm_table(THD*, TABLE_LIST*, bool, bool) ()
#22 0x00000000031f1f53 in mysql_execute_command(THD*, bool) ()
#23 0x00000000031f721b in dispatch_sql_command(THD*, Parser_state*) ()
#24 0x00000000031ed4c2 in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()
#25 0x00000000031eb4a2 in do_command(THD*) ()
#26 0x00000000033cdc5f in handle_connection ()
#27 0x000000000501c1cb in pfs_spawn_thread ()
#28 0x00007fab70f0fea5 in start_thread () from /lib64/libpthread.so.0
#29 0x00007fab6f219b0d in clone () from /lib64/libc.so.6
(gdb)
[16 Jun 2022 9:55] Rahul Malik
Drop AHI during drop tablespace

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug#107207.patch (application/octet-stream, text), 71.40 KiB.

[16 Jun 2022 16:02] OCA Admin
Contribution submitted via Github - PS-107207 Assertion Failure buf0buf.cc:4318:page_size.equals_to(spaceā€¦ 
(*) Contribution by Rahul Malik (Github rahulmalik87, mysql-server/pull/412#issuecomment-1157718840): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_969121117.txt (text/plain), 71.77 KiB.