mysql error: Can't create a new thread (errno 11)

Kevin Nguyen picture Kevin Nguyen · Mar 29, 2013 · Viewed 21k times · Source

I have a db server running Percona Xtradb server, and 5 slaves. I always get the error

mysql error: 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

Though i set ulimited

root@master:~# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 2062915
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1000000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1000000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited





root@master:~# cat /proc/`pidof mysqld`/limits | egrep "(processes|files)"Max processes 1000000 1000000 processes
Max open files 1000000 1000000 files

I really dont know what's going on? Please help me.

Answer

hdang picture hdang · Apr 1, 2013

It seem that your system reach to the maximum number of thread per process, please verify status of your system about threads:

$ cat /proc/sys/kernel/threads-max

$ echo 'SHOW STATUS;' | mysql | grep -i threads

You should also review your current settings about thread_cache_size, This link may help: https://serverfault.com/questions/408845/what-value-of-thread-cache-size-should-i-use

PS: This topics should be posted in serverfault.com