0

My hosting company migrated my server to a newer machine a week or so ago and aside from a small ORDERBY issue on one query, things were running very smoothly.

Last night, out of the blue, I started getting terrible speed on my sites and found an error log full of "socket() failed (24: Too many open files) while connecting to upstream" errors. I was thinking something in my custom CMS admin might be going haywire and worked on it for a couple hours last night before the error messages suddenly went away and everything started running smoothly.

This afternoon, the server started acting up again. I rebooted the machine and it immediately started filling the nginx error log with the same errors. Again, after 10 minutes or so, the errors stopped and the server has run smoothly since then.

I am not a UNIX admin by any means, but I can think fairly logically. I am at a loss as to what the heck is going on here.

  • 1
  • What's in the /proc/..../fd directory for the process that's logging those errors? – Joseph Sible-Reinstate Monica Oct 2 '19 at 2:20
  • Seeing as how the error is showing in the nginx log, are you asking about the pid for nginx? I apologize in advance if that is a stupid question. – Mike Oct 2 '19 at 3:05
2

You can check with ulimit -n to see how many files system allow, it is configurable on users in case you nginix is not running as root. As a temporary fix you can increase the value if is not already set to max in the /etc/security/limits.conf. Meanwhile check your app maybe is keeping the connections active and is not closing them, i assume is a app problem.

If you use * instead of username it will apply to all users.

/etc/security/limits.conf

*     soft   nofile  1024        
*     hard   nofile  65535
|improve this answer|||||
  • Claww, I have made the change and (so far) everything is running smoothly. I appreciate your help on this. – Mike Oct 2 '19 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.