Bug #117917 InnoDB: Failing assertion: lock->lock_word == X_LOCK_DECR
Submitted: 8 Apr 16:01 Modified: 9 Apr 15:19
Reporter: asdsa nxxs Email Updates:
Status: Need Feedback Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:8.0.32、5.7.44 OS:Linux
Assigned to: MySQL Verification Team CPU Architecture:x86
Tags: race condition

[8 Apr 16:01] asdsa nxxs
Description:
When the main thread knocks out the table definition cache, the index on the table is not unlocked, and someone else is using the index, triggering concurrent security issues.
When table->n_ref_count==0 and btr_search_t->ref_count==0, the table can be eliminated. The AHI switch is not turned on. It is suspected that mysqld does not perform concurrent protection on table->n_ref_count, causing the crash.

InnoDB: Assertion failure in thread in file sync0rw.cc line 313
InnoDB: Failing assertion: lock->lock_word == X_LOCK_DECR
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/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
17:25:36 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
InnoDB: about forcing recovery.
17:25:36 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 100384 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
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 = 0 thread_stack 0x80000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x3c)[0x55a3f43d13ac]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x50b)[0x55a3f3a9b9fb]
#0  dict_index_remove_from_cache_low (table=table@entry=0x7fbfc64814a0, index=0x7fbfc64894a0, lru_evict=lru_evict@entry=1) at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/dict/dict0dict.cc:3056
#1  0x0000563d4be91ca5 in dict_table_remove_from_cache_low (table=0x7fbfc64814a0, lru_evict=1) at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/dict/dict0dict.cc:2381
#2  0x0000563d4be95ccc in dict_make_room_in_cache (max_tables=400, pct_check=pct_check@entry=50) at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/dict/dict0dict.cc:1745
#3  0x0000563d4bd47654 in srv_master_evict_from_table_cache (pct_check=pct_check@entry=50) at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/srv/srv0srv.cc:2056
#4  0x0000563d4bd4f028 in srv_master_do_active_tasks () at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/srv/srv0srv.cc:2229
#5  0x0000563d4bd4f639 in srv_master_thread (arg=<optimized out>) at /workdir1/jinxing/rds/rds_57/mysql-server/storage/innobase/srv/srv0srv.cc:2461
#6  0x00007fc00fa31e15 in start_thread () from /lib64/libpthread.so.0
#7  0x00007fc00e796fed in clone () from /lib64/libc.so.6

How to repeat:
The crash was triggered by high concurrent DDL/DML and frequent elimination of indexed tables.

Suggested fix:
It may be that table->n_ref_count is not properly monitored.
[9 Apr 15:19] MySQL Verification Team
Hi,

8.0.32 is rather old, can you reproduce this with latest 8.0?

Thanks