Bug #5656 Can't create a new thread (errno 11)
Submitted: 19 Sep 2004 20:20 Modified: 11 Oct 2004 3:57
Reporter: Egor Egorov Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.21 OS:Linux (Linux, kernel
Assigned to: Lachlan Mulcahy CPU Architecture:Any

[19 Sep 2004 20:20] Egor Egorov

[egor@toyou egor]$ mysql -uroot -pxxxx
ERROR 1135: 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

This is Linux 2.6.x. MySQL is 4.0.21, official binary RPMs, not -Max. Hardware is dual CPU P3-933, 1024MB RAM.


set-variable = max_connections=1000
set-variable = key_buffer_size=384M
set-variable = read_buffer_size=64M
set-variable = read_rnd_buffer_size=32M
set-variable = thread_cache_size=20

The .err file contains no clues. Not even mysqld restart or something. Clean.

The problem occurs on this server at least daily, at about ~130 mysql threads running. Until I kill clients (and therefor, mysql threads) - I cannot connect to MySQL, I have this error. BTW, right now MySQL permitted to connect when there was ~120 threads.

This started at version .18.

How to repeat:
Easy repeatable at one my servers and only there. Just open ~60 new connections and you will be able to catch the situation.
[11 Oct 2004 3:57] Lachlan Mulcahy
This appears to be a problem with running out of memory rather than a bug.

It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + 
sort_buffer_size)*max_connections = (in your case) 384M + (64M + 2M)*1000 = 66384M 

You have your server configured to attempt to use up to around 66G of memory and there is 
only 1G+swap in the machine (even though you have swap, you never want to hit this on a DB 
You should reduce these values in line with the performance you require such that they do not 
exceed the maximum amount of memory available. (Remember that your OS and other 
processes will require memory too)
[11 Oct 2004 18:06] Egor Egorov

Thank you, Lachlan.