Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ too many files open error

In IntelliJ IDEA 13.1.5 on Ubuntu 14.04 LTS I see an occasional error in large projects that says "too many files open". Interestingly, this refuses to go away and freezes the IDE completely. I've tried the following things to fix it.

1) Modify my /etc/sysctl.conf to have this line as shown in this article here. Made the error less frequent:

fs.inotify.max_user_watches = 524288    
fs.file-max = 380180 

2) Raise the ulimit -n setting on the IntelliJ process to 64k. I don't notice any difference in performance with this, but the article that I mentioned above claims that it will help.

3) Add this to my idea64.vmoptions file (helps with speed of indexing, but not with this problem)

-Xms128m
-Xmx8192m
-XX:MaxPermSize=1024m

Has anyone else seen this error and do you have any other suggestions of what I can do to fix it?

I've considering asking IntelliJ support, but I've found I need to go back and forth with them a few times before I get a helpful answer. Any advice from the community on this would be appreciated.

like image 982
Jason D Avatar asked Oct 12 '14 13:10

Jason D


1 Answers

I spoke to IntelliJ support. They suggested that part 2 that I mentioned was not taking effect. I tried these steps:

1) sudo vi /etc/security/limits.conf and add these lines (take a backup too):

*       soft    nofile  380180
*       hard    nofile  380180

2) sudo vi /etc/pam.d/common-session add this line (take a backup too):

session required pam_limits.so

3) sudo vi /etc/pam.d/common-session-noninteractive add this line (take a backup too):

session required pam_limits.so

4) Reboot your machine

5) Confirm this took effect by running this command, you should see this result

~$ ulimit -n
380180

I reopened my large project after that and I haven't seen the "too many files open" message since then.

like image 102
Jason D Avatar answered Oct 19 '22 00:10

Jason D