Bug #102323 Using innodb_interpreter results in a crash on the debug build
Submitted: 20 Jan 2021 21:57 Modified: 25 Jan 2021 10:09
Reporter: Hrvoje Matijakovic Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:8.0.23 OS:Linux
Assigned to: CPU Architecture:x86

[20 Jan 2021 21:57] Hrvoje Matijakovic
Description:
gdb:
Core was generated by `/sdc/MS190121-mysql-8.0.23-linux-x86_64-debug/bin/mysqld --no-defaults --basedi'.
Program terminated with signal 6, Aborted.
#0  0x00007f71a0f7aaa1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
59        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
Missing separate debuginfos, use: debuginfo-install openssl-libs-1.0.2k-21.el7_9.x86_64
(gdb) bt
+bt
#0  0x00007f71a0f7aaa1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
#1  0x0000000004d342a4 in my_write_core (sig=6) at /home/hrvoje/sdc/MS-8.0.23_dbg/mysys/stacktrace.cc:308
#2  0x000000000390fa2d in handle_fatal_signal (sig=6) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/signal_handler.cc:171
#3  <signal handler called>
#4  0x00007f719ef8c387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#5  0x00007f719ef8da78 in __GI_abort () at abort.c:90
#6  0x00000000051b94a4 in ut_dbg_assertion_failed (expr=0x6f54949 "found", file=0x6f547e0 "/home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0test.cc", line=294) at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0dbg.cc:98
#7  0x00000000051bef72 in ib::Tester::find_tablespace_physical_page_size (this=0x7f71a144c608, tokens=std::vector of length 2, capacity 2 = {...}) at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0test.cc:294
#8  0x00000000051c08f7 in ib::Tester::run (this=0x7f71a144c608, cmdline="find_tablespace_physical_page_size ts1") at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0test.cc:584
#9  0x00000000051c0ac1 in ib::interpreter_run (command=0x7f7148062e90 "find_tablespace_physical_page_size ts1") at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0test.cc:616
#10 0x00000000051c0c7f in ib_interpreter_check (thd=0x7f7148020000, var=0x7ef93c0 <mysql_sysvar_interpreter>, save=0x7f7148062e60, value=0x7f71a1449060) at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/innobase/ut/ut0test.cc:641
#11 0x0000000003766f62 in sys_var_pluginvar::do_check (this=0x7f718dfb7310, thd=0x7f7148020000, var=0x7f7148062e40) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/sql_plugin_var.cc:332
#12 0x0000000003635ff0 in sys_var::check (this=0x7f718dfb7310, thd=0x7f7148020000, var=0x7f7148062e40) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/set_var.cc:347
#13 0x00000000036383c7 in set_var::check (this=0x7f7148062e40, thd=0x7f7148020000) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/set_var.cc:1032
#14 0x00000000036378bc in sql_set_variables (thd=0x7f7148020000, var_list=0x7f7148025ac0, opened=true) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/set_var.cc:797
#15 0x000000000372b1c2 in mysql_execute_command (thd=0x7f7148020000, first_level=true) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/sql_parse.cc:3466
#16 0x000000000372fff7 in dispatch_sql_command (thd=0x7f7148020000, parser_state=0x7f71a144aa50) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/sql_parse.cc:4988
#17 0x000000000372661c in dispatch_command (thd=0x7f7148020000, com_data=0x7f71a144bb00, command=COM_QUERY) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/sql_parse.cc:1836
#18 0x0000000003724a37 in do_command (thd=0x7f7148020000) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/sql_parse.cc:1320
#19 0x00000000038fa009 in handle_connection (arg=0x7f714b09a300) at /home/hrvoje/sdc/MS-8.0.23_dbg/sql/conn_handler/connection_handler_per_thread.cc:301
#20 0x0000000005587088 in pfs_spawn_thread (arg=0x7f719cc6fa60) at /home/hrvoje/sdc/MS-8.0.23_dbg/storage/perfschema/pfs.cc:2900
#21 0x00007f71a0f75ea5 in start_thread (arg=0x7f71a144c700) at pthread_create.c:307
#22 0x00007f719f05496d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

How to repeat:
Running any of the following:

SET SESSION innodb_interpreter='find_tablespace_physical_page_size ts1';
SET SESSION innodb_interpreter='corrupt_ondisk_page0 test/t1';
SET @@global.innodb_interpreter=@start_global_value;
[21 Jan 2021 6:03] MySQL Verification Team
Hello Hrvoje Matijakovic,

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

regards,
Umesh
[25 Jan 2021 4:52] Annamalai Gurusami
Posted by developer:
 
The variable innodb_interpreter is a debug variable and is to be used for testing purposes.  Please refer to the test mysql-test/suite/innodb/t/dblwr_encrypt.test for correct usage of this variable.  If used incorrectly, it will result in an assert and core dump (instead of giving a useful error message).  

The correct usage would be like this:

Step 1: SET SESSION innodb_interpreter = 'init';
Step 2: CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB;
Step 3: SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size ts1';
Step 4: SET SESSION innodb_interpreter = 'destroy';

If step 3 is done without creating a tablespace ts1, it will assert instead of returning an error message.  Since it is a debug variable meant for testing purposes, I thought this is fine.  Is there any valid reason to call step 3, when it is known that the tablespace ts1 is not there?

Let me know what you think.
[25 Jan 2021 10:09] Hrvoje Matijakovic
Thank you for additional information. It makes sense if used that way. It would be great if the variable description and usage is documented somewhere beside the test file.