[ERROR] Error in accept: Too many open files

Richard G

Verified User
Joined
Jul 6, 2008
Messages
12,924
Location
Maastricht
On two of the servers, once a while the mysql server hangs. It's running but connections are not possible anymore.

So I had a look in the error log and it contains a lot of these lines just before it hangs:
[ERROR] Error in accept: Too many open files

No problem on the other servers. This is the server's my.cnf (same as on every other server):
Code:
[mysqld]
local-infile=0
bind-address = 127.0.0.1
default-storage-engine=MyISAM
innodb_file_format=Barracuda
innodb_file_per_table=1

So I checked the open files setting.
Code:
mysql> show global variables like 'open%' 
    -> ;
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 1024  |
+------------------+-------+
1 row in set (0.00 sec)

Doesn't look too bad does it? Or is 1024 very little?

Checked the same in the mysql process:
Code:
root@serverxx /proc # cat /proc/16496/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            10485760             unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             95088                95088                processes 
Max open files            1024                 4096                 files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       95088                95088                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

So what exactly needs adjustment, and why only on two servers?
The other server has 32768 on "max locked memory" by the way.
 
Thank you. I know I can rais the limit and how (I already put it to 2048 now).
But I don't know why this problem occurs on two servers and on one more then on the other.

On one server it might be because a cron is running there which takes care for Centova and shoutcast stuff, some streaming radio is working there. But that's in fact the server without problems.

The other server just have a lot of wordpress installations. No crontabs running so I really woulnd't know where to look for.
Do you have any idea's, suggestions?
 
The other server just have a lot of wordpress installations. No crontabs running so I really woulnd't know where to look for.

wp-cron.php still exists on all installations by default.

Do you have any idea's, suggestions?

Munin and monitoring, httpd-status and watching, mtop/mysqladmin etc.
 
Hope that too. Just in case if you want to solve the issue without investigating the reasons, then no need to do anything else. But in case you want to find reasons, then you should really do some research work.
 
Hello zEitEr.
I don't know if it's normal on a server or not. I've read from other servers that they standardly put that on 3000.
Maybe I would like to do some research work, but I don't really know where or what to look for.

However, I already took your advise and with the help of Sellerone was able to install Munin on every server.
 
I don't know if it's normal on a server or not. I've read from other servers that they standardly put that on 3000.

Why not?

open_files-day.png

Check the attached picture from munin, 3K is not that big, unless it slows your server much.

All my open_files_limit defaults to 64k! (bit extreme)

And how much of them are opened usually?
 
Check the attached picture from munin, 3K is not that big, unless it slows your server much.
I got the setting in my.cnf to 2048, but since I installed munin a couple of days ago, the biggest peak of the picture you point to on my server is 344.10 (open files) and it's really a big peak. Minimal it's 88 and average 142.48 according to munin... without the k behind it.

Last time I hadd the too many open files notice (on 2 servers) was on may 13th but then I hadn't installed munin yet.
 
Thank you.
I've read the article but it a lot to do. What's the difference in just setting in only in my.cnf?
Because that's working fine too.
 
Back
Top