Kevin's Blog

IT, Scala, Java, Web, Ubuntu

Eclipse – “Too many open files” Problem

If your OS is Linux and you are using Eclipse, you might possibly see the following error messages or similar after installing lots of plug-ins in Eclipse. In my case, it usually happened after installing TPTP (I’m using Ubuntu Linux 9.04 Jaunty Jackalope Desktop 64bit by the way).

Plug-in org.eclipse.jst.server.tomcat.core was unable to load class org.eclipse.jst.server.tomcat.core.internal.TomcatLaunchConfigurationDelegate.
 /eclipse_installed_path/eclipse/configuration/org.eclipse.osgi/.lazy.15 (Too many open files)


Problems occurred while trying to save the state of the workbench.
 Could not read master table.
 /your_workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources (Too many open files)

or error in opening zip file

This is because there are too many files opened and these are more files than the number of open files allowed . So Eclipse cannot open more files and displays the errors above.

Let’s see the number of open files.

$ lsof | wc -l 


$ lsof | wc -l 

In my case, it was 8965.

What about the number of files Eclipse opens. To see it, use

$ lsof | grep eclipse | wc -l 

In my case,

$ lsof | grep eclipse | wc -l 

2094 files are opened.

Now check the limitation of open files

$ ulimit -a 
core file size          (blocks, -c) #
data seg size           (kbytes, -d) #
scheduling priority             (-e) #
file size               (blocks, -f) #
pending signals                 (-i) #
max locked memory       (kbytes, -l) #
max memory size         (kbytes, -m) #
open files                      (-n) 1024
pipe size            (512 bytes, -p) #
POSIX message queues     (bytes, -q) #
real-time priority              (-r) #
stack size              (kbytes, -s) #
cpu time               (seconds, -t) #
max user processes              (-u) #
virtual memory          (kbytes, -v) #
file locks                      (-x) #

or just use

$ ulimit -n 

To change it, open the file /etc/security/limits.conf and put a greater number than 1024 depending on the number of open files you checked with lsof | wc -l just before.
For example,
Open the file

$ gksudo gedit /etc/security/limits.conf 
add these lines
*                soft    nofile          9216
*                hard    nofile          9216

I just chose some big number that is 9216 (9 * 1024) as it’s greater than 8965

Log out and in then check with ulimit. It should show like this.

$ ulimit -n 

You may try this

$ ulimit -n 9216 

yet I don’t believe it changes the limit for open files permanently. So you’d better modify /etc/security/limits.conf file.

If it is still not changed. Restart the computer and check again. If it still doesn’t show the changed value, open /etc/pam.d/common-session file and add session required

Open the file to edit

$ gksudo gedit /etc/pam.d/common-session 

Add the following line

session required

Log out and in. Now it should work!

$ ulimit -n 
Loading Disqus Comments ...
Loading Facebook Comments ...


  1. hey Kevin,
    been reported on fedora support forum too:

    • Kevin

      18 August, 2009 at 10:38 pm

      Thanks, Chris.

      I think it’s a very common problem for those who use Linux and install lots of plugins just like myself. :)

  2. thanks!

  3. Thank you very much. This problem was causing me nothing but headaches after installing some very useful (but heavy) company plug-ins… it’s always nice to find clear, effective help like yours!

    • Thanks for your comment and I’m glad to hear that you solved it. I had the same problem so I can understand what you felt when you had that problem. :)

  4. I have changed all the files as you said…
    and it crashed my autologin… :(
    I am using ubuntu 8.04
    any idea of it?…thx

  5. what I mean crashed is, it keep saying authentication fail even I input a correct password…just keep refreshing the autologin screen…
    cannot boot into the system…

    • Kevin

      3 March, 2010 at 2:02 am

      Hello, Anthony
      I’m sorry but I have no idea. Unfortunately (or fortunately) I have never seen anyone had that kind of problem after following the instruction above.
      have you tried using a console?
      If you haven’t, try it by pressing Ctrl+Alt+F1 keys.

  6. Yes, I have tried. but seems no go…
    It doesn’t display the login request…
    just display a flashing line and go back to the auto login screen….
    when I type the command, I use sudo instead of gksudo, do you think it is possible caused by this?
    thx anyway

    • Kevin

      3 March, 2010 at 3:01 pm

      No, I don’t believe that had anything to do with your problem. ‘gksudo’ is simply ‘sudo’ for the GUI environment. You’d better use ‘gksudo’ when you want to open any GUI based desktop applications, yet using ‘sudo’ causes the problem like that just doesn’t make any sense.

      The description of your problem indeed reminds me of the same problem I had before. I think I probably had the same one when I used the 8.x version but don’t remember the exact version number. In my case, it, of course had nothing to do with the instruction above. It just happened one day when I turned on my PC. I didn’t do anything special that time nor did I have any idea how to solve it so re-installed the Ubuntu.

      I obviously didn’t want to lose the important data so used Ubuntu Live CD to boot then copied the data to another partition and finally re-installed it. If your problem keeps happening and you can’t find any solution, I suggest using Live CD and restore the settings you have changed. Then you can see if the changes you made caused the problem. Good luck!

  7. No solution, tried to recover all the files back to original setting via usb boot system, still can’t login…
    can’t login even changed my password manually from file… viewed the log and I think it is a pam issue… I don’t know it is a bug of Ubuntu 8.04 or not…
    please tell me what is the problem if anyone know, although I planned to reintall the OS to 9.10 already…
    anyway, thanks Kevin

Leave a Reply

© 2019 Kevin's Blog

Theme by Anders NorenUp ↑

%d bloggers like this: