Description:
I'm having an issue with MySQL in that I get an assertion failure almost every time I try to open a table, mostly in MySQL Workbench, but sometimes in phpmyadmin as well. I do not know how long this has been going on since I don't use MySQL Workbench and phpmyadmin that often and I don't look in the MySQL err logg that often either, but it is definitely a problem in both 8.0.30 and 8.0.31.
I am currently compiling MySQL myself with clang (Apple LLVM version 10.0.1 (clang-1001.0.46.4)) and with these options: cmake .. -DBUILD_CONFIG=mysql_release -DWITH_BOOST=../boost -DWITH_UNIT_TESTS=OFF
The assertion failure that I get:
2022-11-22T15:16:05.229667Z 49 [ERROR] [MY-013183] [InnoDB] Assertion failure: dict0dict.cc:1222:table2 == nullptr thread 0x700010616000
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
15:16:05 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x7fd43fd4b200
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 700010615ea8 thread_stack 0x100000
0 mysqld 0x00000001012639ec my_print_stacktrace(unsigned char const*, unsigned long) + 60
1 mysqld 0x00000001006e4bcb print_fatal_signal(int) + 411
2 mysqld 0x00000001006e4d96 my_server_abort() + 70
3 mysqld 0x000000010125cc1a my_abort() + 10
4 mysqld 0x00000001016c22db ut_dbg_assertion_failed(char const*, char const*, unsigned long long) + 395
5 mysqld 0x00000001013ef1c1 dict_table_add_to_cache(dict_table_t*, bool) + 1281
6 mysqld 0x0000000101413850 dict_table_t* dd_open_table_one<dd::Table>(dd::cache::Dictionary_client*, TABLE const*, char const*, dd::Table const*, THD*, std::__1::deque<char const*, ut::allocator<char const*, ut::detail::allocator_base_pfs<char const*> > >&) + 5920
7 mysqld 0x0000000101400c41 dict_table_t* dd_open_table<dd::Table>(dd::cache::Dictionary_client*, TABLE const*, char const*, dd::Table const*, THD*) + 65
8 mysqld 0x00000001014dc3d5 ha_innobase::open(char const*, int, unsigned int, dd::Table const*) + 3093
9 mysqld 0x00000001001809a7 handler::ha_open(TABLE*, char const*, int, int, dd::Table const*) + 87
10 mysqld 0x0000000100665ffd open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, dd::Table const*) + 3373
11 mysqld 0x0000000100497f06 open_table(THD*, TABLE_LIST*, Open_table_context*) + 3238
12 mysqld 0x000000010049d3a2 open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) + 2434
13 mysqld 0x000000010049f9dd open_tables_for_query(THD*, TABLE_LIST*, unsigned int) + 109
14 mysqld 0x00000001005ae1ad Sql_cmd_dml::prepare(THD*) + 317
15 mysqld 0x00000001005aea7a Sql_cmd_dml::execute(THD*) + 266
16 mysqld 0x0000000100553552 mysql_execute_command(THD*, bool) + 5794
17 mysqld 0x000000010055080a dispatch_sql_command(THD*, Parser_state*) + 1114
18 mysqld 0x000000010054f032 dispatch_command(THD*, COM_DATA const*, enum_server_command) + 7506
19 mysqld 0x000000010054fe2d do_command(THD*) + 525
20 mysqld 0x00000001006cb3b4 handle_connection(void*) + 388
21 mysqld 0x000000010173f73a pfs_spawn_thread(void*) + 314
22 libsystem_pthread.dylib 0x00007fff6abac2eb _pthread_body + 126
23 libsystem_pthread.dylib 0x00007fff6abaf249 _pthread_start + 66
24 libsystem_pthread.dylib 0x00007fff6abab40d thread_start + 13
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fd43fde4230): SELECT COUNT(*) FROM `gallery2`.`g2_AccessMap`
Connection ID (thread ID): 49
Status: NOT_KILLED
Have run check on all tables and databases and no errors or corruptions.
Have also tried a dump and a fresh data directory with import of said dump, but no difference.
Doesn't always trigger on all tables, usually more often on tables that has many rows - like 1000+.
I do not get any assertion failures when starting MySQL and I have many web applications running and they all work fine with MySQL, it's only when opening tables in MySQL Workbench or phpmyadmin that I get assertion failures.
One odd thing is that I can avoid these assertions if I run an analyze on the tables before opening them and that works every time!
Also one thing I can mention is that I ran an optimize on all my tables on all databases and that changed some of them from COMPACT to DYNAMIC if that is of any relevance.
Also tried doubling the thread_stack to 2097152 but no difference.
How to repeat:
In my case I can repeat it by quitting MySQL Workbench and restarting the MySQL server and connecting with MySQL Workbench and tailing the MySQL err log and opening a table, usually a table with 1000+ rows triggers the assertion and it triggers this assertion every time I open the same table (that triggers it) until I run Analyse on it, then the assertion stops!