Ir al contenido principal

MySQL Server Error – “Can’t Create A New Thread (errno 11)”

 

MySQL Server Error – “Can’t Create A New Thread (errno 11)”

OS error 11 is “Resource temporarily unavailable”. The most common cause of receiving this error when trying to create a new thread is having hit the process’s kernel enforced a limit on open file descriptors. The second most common cause is having hit the process’s kernel enforced limit on the number of processes/threads.

Here are the factors involved:

  1. The system-wide limits: sysctl -e fs.file-max && sysctl -e kernel.threads-max
  2. The per-process limits (in a *new* shell): ulimit -n, grep nofile /etc/security/limits.conf and ulimit -u, grep nproc /etc/security/limits.conf.
  3. The open_files_limit setting in mysqld (mysql> show global variables like “open_files_limit”;).
  4. The other settings within mysqld that can affect the number of open FDs and threads that the process may use (max_connections, thread_cache_size, table_open_cache, table_definition_cache, innodb_open_files, etc.)

Assuming that it was in fact that we hit the open-files-limit, which defaults to 1024 on most Linux systems – we should be able to avoid the issue by taking these steps:

1. Increasing the explicit open files limit in mysqld by making this change to the my.cnf file:

[mysqld]

# Here X could be (max_connections+table_cache)*3  OR you could simply set it very high, for example 32000
open-files-limit = X 

2. Restart mysqld service:

/etc/init.d/mysql restart

NPROC limits

If it instead appears that the nproc limit is the cause (CentOS 6 puts a low limit on this in /etc/security/limits.conf), then we can increase the nproc limit in a few different ways.

1. Edit limits.conf:

We can set the limits for the mysql user in the limits.conf file, for example:

mysql soft nproc 10240
mysql hard nproc 40960

Note that limits.conf only applies to login shells and does not affect processes started by init or systemd. Any changes to limits.conf will only apply to new logins, you must log out and log in to start a new session.

2. Edit the mysqld_safe script:

We can also simply add a ulimit call near the top of the mysqld_safe script, for example:

$ ulimit -u 40000

3. Use a wrapper script:

Refer below post on “How to use a Wrapper Script to set Custom Per-Process Attributes for MySQL Server”.

We will need to restart mysqld in order for the changes to take effect.

Comentarios

Entradas más populares de este blog

DAHDI ASTERISK

  Comandos DAHDI interesantes dahdi_cfg Este comando configura los módulos del kernel DAHDI desde el archivo /etc/dahdi/system.conf,  No ejecutar este comando si ya tienes tu sistema trabajando correctamente. Ejemplo de uso: Solo escribir en la consola dahdi_cfg dahdi_genconf Este script genera archivos de configuración para hardware DAHDI.  No ejecutar este comando si ya tienes tu sistema trabajando correctamente. Ejemplo de uso: Solo escribir en la consola dahdi_genconf dahdi_hardware Muestra las tarjetas conectadas a nuestro servidor y que son detectadas por Asterisk DAHDI. Es util cuando quieres saber si tu Asterisk encontró la interfaz telefónica colocada. Puedes compararla con lspci de Linux. Ejemplo de uso: Solo escribir en la consola dahdi_hardware dahdi_monitor Es una representación gráfica de la intensidad del audio, facilita observar si las señales recibidas o transmitidas son demasiado alto o fuera de balance. De igual manera permite grabar el canel en un arch...

The Elder Scrolls III: Morrowind - Edición Juego del Año

  The Elder Scrolls III: Morrowind - Edición Juego del Año JUEGO COMPLETO PARA PC DISPONIBLE EN GOG.COM Morrowind es un RPG para un jugador, épico y de final abierto, que te permite crear cualquier tipo de personaje imaginable y jugar con él, y está disponible para los miembros KEY: QLZ627B0FD65E0541F SPARTAN!!! APOYEN DANDO LIKE A MIS REDES SPARTAN.!! #FREEGAMES #GAMING #JUEGOS #PCGAMING #JUEGOSGRATIS #SPARTAN #SPARTANFREE #TWITCH #GRACIASTOTALES #VTUBER #FREE #HAPPY #REGIO #GAMES #GAMER #GAMERS #GAMEOVER #FOLLOWTOFOLLOW #PROJECTFREE #GRATIS #JUEGOSGRATIS #FREESPARTAN #GIFTGAMES #KEYGAME #SERIALJUEGO SIGANME!!! youtube.com/@thespartanfreegames Se vienen juegos nuevos!!!! GRACIAS TOTALES! New games are coming!!!!