How to fix too many open files error

Valic —  January 29, 2013 — Leave a comment

If you are getting “too many open files” error this  is how to fix it.

To change the file descriptor setting you need to add the line fs.file-max=50000 to the kernel parameters file /etc/sysctl.conf

echo "fs.file-max = 500000” >> /etc/sysctl.conf

OR

Open /etc/sysctl.conf file with any editor and add the fs.file-max=50000  line to the file.

To apply all changes run the following command:

sysctl -p

The final step is to change the ulimit setting hard and soft limits.

Open  /etc/security/limits.conf file and set the hard and soft limits by adding the following lines:

nano /etc/security/limits.conf
* soft nofile 60000
* hard nofile 60000

Now to apply the changes you need to reboot:

reboot

Enjoy.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply