2019
MySQLERRORCommonServerHIGH confidence

Cannot create new thread

Production Risk

Critical — new connections are refused.

What this means

MySQL failed to create a new OS thread to handle an incoming connection. This usually indicates the server has exhausted OS-level thread or process limits.

Why it happens
  1. 1OS thread limit (ulimit -u) reached.
  2. 2max_connections set higher than the OS can support.
  3. 3Memory exhaustion preventing new thread stack allocation.
  4. 4OS kernel parameter limits exceeded.
How to reproduce
trigger — this will error
trigger — this will error
-- Occurs at connection time under extreme load

expected output

ERROR 2019 (HY000): Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug.

Fix 1

Increase the OS thread/process limit

Increase the OS thread/process limit
-- In /etc/security/limits.conf:
mysql soft nproc 65535
mysql hard nproc 65535

Why this works

Higher OS limits allow MySQL to spawn more connection threads.

Fix 2

Reduce max_connections to a level the OS can support

Reduce max_connections to a level the OS can support
SET GLOBAL max_connections = 500;

Why this works

Capping connections prevents the OS limit from being reached.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 2019 ER_CANT_CREATE_THREAD

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors