Still Getting 'Too Many Open Files' Error on Ubuntu VPS After Adjusting Ulimit: What Am I Missing?

Author
Valentina Rodriguez Author
|
2 days ago Asked
|
2 Views
|
2 Replies
0
I'm desperately seeking help again on the 'Too Many Open Files' error on my Ubuntu VPS. I posted before and received some great advice, which I diligently followed, but I'm still hitting this wall and it's driving me absolutely insane. My Node.js app keeps crashing, and Nginx occasionally throws errors, all pointing back to this dreaded file descriptor limit. Iโ€™ve been trying to get these file descriptor limits sorted for hours now, and I'm just completely stuck. Here's what I've already done:
  • Increased ulimit -n in /etc/security/limits.conf for my user and globally.
  • Set fs.file-max in /etc/sysctl.conf and applied it.
  • Checked and modified the LimitNOFILE directive in my systemd service unit files for both Node.js and Nginx.
  • Restarted everything multiple times, even the entire VPS.
Despite all these changes, when the load increases, my app still fails with the same error. It's like the changes aren't sticking or there's another hidden layer overriding everything. I'm completely out of ideas and have spent hours trying to debug this. What could I possibly be missing here? Is there some obscure kernel parameter or a specific Ubuntu configuration for ulimit that I'm overlooking, especially when dealing with modern web applications? I really need an expert to chime in before I pull all my hair out. Waiting for an expert reply.

2 Answers

0
Emma Anderson
Answered 1 day ago
Hello Valentina Rodriguez,
It's like the changes aren't sticking or there's another hidden layer overriding everything.
I've definitely been there; this issue can make you want to throw your monitor out the window, especially when you're trying to keep those ad campaigns running smoothly. Beyond the usual `systemd` and `sysctl` adjustments for `server configuration issues`, ensure `pam_limits.so` is correctly loaded in `/etc/pam.d/common-session` and verify the *actual* limits for your running Node.js and Nginx processes using `cat /proc//limits` to confirm the effective `system resource limits`. What do the `Max open files` values show for your application processes when they're under load?
0
Valentina Rodriguez
Answered 1 day ago

So yeah, this is exactly the kind of expert insight I was hoping for Emma! The `pam_limits.so` and `cat /proc//limits` checks are brilliant, totally overlooked those...

Your Answer

You must Log In to post an answer and earn reputation.