7

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.

AndreyAkinshin
  • 18,603
  • 29
  • 96
  • 155
Kevin Nguyen
  • 1,759
  • 2
  • 16
  • 14
  • Probably the mysql thread limit is configurable thru `/etc/mysql.conf` or `/etc/my.cnf` ... – Basile Starynkevitch Mar 29 '13 at 06:19
  • The maximum number of threads (processes in fact on linux) per user (or system wide) was reached when trying to create a new thread. – alk Mar 29 '13 at 11:13
  • It also could be a memory issue as indicated by this bug report: http://bugs.mysql.com/bug.php?id=5656 – alk Mar 29 '13 at 11:28
  • tmp_table_size = 1024M max_heap_table_size = 64M query_cache_type = 0 query_cache_size = 256M query_cache_limit = 256M max_connections = 502400 wait_timeout = 60 thread_cache_size = 100 open_files_limit = 1000000 table_definition_cache = 4096 table_open_cache = 900000 – Kevin Nguyen Mar 29 '13 at 13:41

2 Answers2

3

Add a line like this to /etc/security/limits.conf

mysql  soft  nproc  4096

Then restart mysql

Steven Lizarazo
  • 5,320
  • 2
  • 28
  • 25
2

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

Artem Russakovskii
  • 21,516
  • 18
  • 92
  • 115
hdang
  • 608
  • 5
  • 9