Solving “Too many open files” Eclipse problem on Ubuntu

Sometimes writing a blog post is not only a mean to share thoughts or ideas but can also be a good reminder for little tips you made time to find but no time to forget ! The today problem resolution can be found on many sources on the web but I write it down here to be sure, I’ll find it next time I’ll see it …

If your OS is Linux (Ubuntu 12.04 in my case), and you’re using Eclipse (SpringSource Tool Suite in my case) with a lot of plug-ins or maybe many instances of Eclipse running up, you might end up seeing this error message appear :

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)

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

To check the number of opened file for your user, type the following command line in a terminal :

$lsof | grep <your_user> | wc -l

By default, the number of allowed open files is 1024 on Ubuntu and you see that we far far away from this limit ! (the current limit can be seen sending ulimit -a on terminal).

To raise this limit, you just have to edit the /etc/security/limits.conf file and add a directive with a greater number that the one you get when checking opened files with lsof | wc -l.

So, let’s edit the file in root mode :

$sudo gedit /etc/security/limits.conf

and add this line at the end of the file :

<your_user>	 hard      nofile          9216

Save the file and close the text editor. You just allow the user to open up to 9216 (9 x 1024) files ! That’s all folks.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s