Databases 8 min read

Resolving MySQL Error 1135: Can't Create New Thread by Adjusting Systemd TaskMax

The article explains how the MySQL "Can't create a new thread (errno 11)" error on SLES12SP5 was diagnosed as a TaskMax limit issue and resolved by increasing the system‑wide DefaultTasksMax or setting a per‑service TasksMax, followed by a MySQL restart to apply the changes.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Resolving MySQL Error 1135: Can't Create New Thread by Adjusting Systemd TaskMax

The author encountered MySQL 8.0.18 on SLES12SP5 reporting error 1135: "Can't create a new thread (errno 11)" when the application attempted to open many connections.

2021-08-11T12:25:40.606774+08:00 0 [ERROR] [MY-000000] [connection_h] Error log throttle:         36 'Can't create thread to handle new connection' 
error(s) suppressed
2021-08-11T12:25:40.606886+08:00 0 [ERROR] [MY-010249] [Server] Can't create thread to handle new connection(errno= 11)

After confirming the user’s ulimit settings were correct, the investigation focused on the systemd TaskMax limit, which was found to be at its default value of 512 tasks.

To fix the issue without restarting MySQL, the system‑wide DefaultTasksMax was increased:

# systemctl show --property=DefaultTasksMax
DefaultTasksMax=512
# vi /etc/systemd/system.conf
#DefaultTasksMax=512
DefaultTasksMax=5120
# systemctl daemon-reexec
# systemctl show --property=DefaultTasksMax
DefaultTasksMax=5120
# systemctl status mysql
... Tasks: 62 (limit: 5120) ...

Testing with sysbench still showed the error, so MySQL was restarted, after which the service operated normally.

[ 3s ] thds: 600 tps: 563.43 qps: 9803.74 ...
[ 9s ] thds: 600 tps: 3031.18 qps: 48139.37 ...

The MySQL status now displayed an increased task count, confirming the new limit:

# systemctl status mysql
... Tasks: 649 (limit: 5120) ...

An alternative method modifies the service unit directly:

# cd /etc/systemd/system/
# mkdir mysql.service.d
# cd mysql.service.d/
# vi override.conf
[Service]
TasksMax=10000
# systemctl daemon-reload
# systemctl restart mysql
# systemctl status mysql
... Tasks: 108 (limit: 10000) ...

After restarting MySQL, the per‑service limit took effect, and further sysbench runs with 600 concurrent threads succeeded, demonstrating that both system‑level and process‑level adjustments resolve the thread‑creation error, provided the MySQL service is restarted.

Conclusion: Increase DefaultTasksMax system‑wide or set TasksMax in a MySQL service drop‑in, then restart MySQL to apply the new task limits.

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.

Linuxmysqlsystemderror-1135TaskMaxthread-limit
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

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.