Databases 4 min read

Why MySQL 8.0.38 Crashes with Over 10,000 Tables and How to Fix It

Upgrading to MySQL 8.0.38 (or later) causes crashes when an instance contains more than ten thousand tables, even with validate_tablespace_paths disabled, but using a shared or general tablespace configuration can reliably avoid the failure.

ITPUB
ITPUB
ITPUB
Why MySQL 8.0.38 Crashes with Over 10,000 Tables and How to Fix It

Percona senior engineer Marco Tusa reported that MySQL versions ≥ 8.0.38 (including 8.4.1 and 9.0.0) crash on instance restart when the number of tables exceeds ten thousand, and the usual workaround validate_tablespace_paths=OFF does not help.

Reproduction steps (tested on MySQL 9.0.0):

-- Create a simple database and table, then insert a row
CREATE DATABASE test;
USE test;
CREATE TABLE t_1 (
  `id` int NOT NULL,
  PRIMARY KEY (`id`)
);
INSERT INTO t_1 SELECT 1;

Repeatedly create similar tables until the count reaches 10,000:

SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_SCHEMA='test';
+----------+
| count(*) |
+----------+
|    10000 |
+----------+

After restarting the instance, the error log shows InnoDB scanning thousands of tablespace files and eventually a segmentation fault (SIGSEGV), e.g.:

[Note] [MY-012207] [InnoDB] Using 2 threads to scan 10002 tablespace files
[Note] [MY-012200] [InnoDB] Thread # 0 - Checked 876/10002 files
...
2024-07-12T06:48:14Z UTC - mysqld got signal 11 ;
Signal SIGSEGV (Address not mapped to object) at address 0x508
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
...

The bug is considered low‑severity but reproducible and easy to avoid. The recommended mitigation is to use a shared or general tablespace instead of the default per‑table tablespace:

-- 1. Shared tablespace (disable per‑table file)
SET GLOBAL innodb_file_per_table = 0;
CREATE TABLE ...;

-- 2. General tablespace
CREATE TABLESPACE test ADD DATAFILE 'test.ibd';
CREATE TABLE t_1 (...) TABLESPACE=test;

Both approaches have been verified to prevent the crash. Although the bug is minor, applying a shared/general tablespace configuration is a simple and effective workaround.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

InnoDBmysqlCrashTablespaceWorkaround
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.