MySQL Buffer Pool Resize Crash分析

来源:这里教程网 时间:2026-03-01 17:18:28 作者:

MySQL buffer pool在 resize后,导致了crash。  看下日志

2023-06-26T03:10:12.510862Z 0 [Warning] InnoDB: A long semaphore wait:
--Thread 140516243474176 has waited at i_s.cc line 2117 for 265  seconds the semaphore:
Mutex at 0x7ff2c1f4cfb8, Mutex BUF_POOL_ZIP_FREE created buf0buf.cc:1720, lock var 1
processlist输出
                 FROM information_schema.innodb_cmpmem |         0 |             0 |
| 276841 | xx   | 127.0.0.1:34252      | NULL  | Query   |    508 | executing                                              | SELECT
                  page_size, buffer_pool_instance, pages_used, pages_free, relocation_ops, relocation_time
                  FROM information_schema.innodb_cmpmem |         0 |             0 |
            InnoDB: ###### Diagnostic info printed to the standard error stream
2023-06-26T03:10:42.512788Z 0 [ERROR] [FATAL] InnoDB: Semaphore wait has lasted > 600 seconds. We intentionally crash the server because it appears to be hung.
2023-06-26 11:10:42 0x7fcc825ff700  InnoDB: Assertion failure in thread 140516337383168 in file ut0ut.cc line 922
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to 
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.
03:10:42 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.

可以看到是信号量等待超时,导致了crash,process list中的sql是监控的sql,这个sql执行过程中会获取buf_pool_zip_free, resize期间也会持有,这样如果buffer pool比较大,导致等待时间太长,会出现crash,将监控停止,resize正常。这里停监控也是使用了非常规的操作。 sql执行堆栈

i_s_cmpmem_fill_low(THD*, TABLE_LIST*, Item*, unsigned long) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/handler/i_s.cc:2109)
i_s_cmpmem_fill(THD*, TABLE_LIST*, Item*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/handler/i_s.cc:2162)
do_fill_table(THD*, TABLE_LIST*, QEP_TAB*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_show.cc:8188)
get_schema_tables_result(JOIN*, enum_schema_table_state) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_show.cc:8319)
JOIN::prepare_result() (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_select.cc:916)
JOIN::exec() (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_executor.cc:131)
handle_query(THD*, LEX*, Query_result*, unsigned long long, unsigned long long) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_select.cc:191)
execute_sqlcom_select(THD*, TABLE_LIST*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:5155)
mysql_execute_command(THD*, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:2826)
mysql_parse(THD*, Parser_state*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:5584)
dispatch_command(THD*, COM_DATA const*, enum_server_command) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:1491)
do_command(THD*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:1032)
::handle_connection(void *) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/conn_handler/connection_handler_per_thread.cc:313)
::pfs_spawn_thread(void *) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/perfschema/pfs.cc:2197)
_pthread_start (@_pthread_start:54)
thread_start (@thread_start:8)

相关推荐