[Troubleshooting] How to fix ‘Too many open files’ on Linux

Home Forums MyEclipse IDE FAQ – Development [Troubleshooting] How to fix ‘Too many open files’ on Linux

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Riyad Kalla Riyad Kalla 6 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #296008
    Profile photo of Riyad Kalla
    Riyad Kalla

    On Linux (and possibly other Unix-based systems) it’s possible to try and fire up an Eclipse-based product and see an error like the following in your console or log:

    Error: “An internal error occurred during: “MyEclipse Memory Monitor”.
    /home/user/Genuitec/Common/binary/com.sun.java.jre.linux.x86_64_1.6.0.006/lib/amd64/libmanagement.so: /home/user/Genuitec/Common/binary/com.sun.java.jre.linux.x86_64_1.6.0.006/lib/amd64/libmanagement.so: cannot open shared object file: Too many open files”

    The reason behind this is that on Unix based systems the kernel AND the shell (e.g. “console”) can both be set with individual limits on how many file descriptors can be open.

    Naturally the kernel-level limit will be enforced system-wide, and this limit is handled by the fs.file-max argument in the /etc/sysctl.conf file.

    TIP: You can check the current setting by using the command cat /proc/sys/fs/file-max

    It is recommended that you set the kernel file descriptor limit to 200k, you can do that by editing the /etc/sysctl.conf file and adding the following line to it:


    Now that you have done this, it’s still possible that the individual shell file descriptor limit is small enough that when MyEclipse (or Eclipse) starts up, they are still opening too many file descriptors as limited by the shell.

    To increase that value, you will want to edit the /etc/security/limits.conf file and increasing the file handle limits with the following lines:

    * hard nofile 65535
    * soft nofile 65535 

    TIP: You can check the current setting by using the command ulimit -n

    Upping the shell limits to 65k seems to be enough in most cases. When both these tips are used together, you must restart your computer to ensure the changes have taken effect.

    With both of these changes in place, your days of “Too many files open” with MyEclipse on Linux should be long gone!

    A big thanks goes out to user timatracy and the Linux & Java tips blog for the solutions!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.