Eclipse – “Too many open files” Problem

本文详细介绍了在使用Eclipse时遇到文件打开过多导致的错误问题,包括查看已打开文件数量、检查Eclipse打开文件数、了解系统允许的最大打开文件数,并提供了调整系统配置限制以解决此问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自:《http://blog.lckymn.com/2009/08/11/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)
or

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

java.util.zip.ZipException: 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
e.g.)

$ lsof | wc -l
8965
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
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
1024
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
9216
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 pam_limits.so.

Open the file to edit
$ gksudo gedit /etc/pam.d/common-session
Add the following line

session required pam_limits.so
Log out and in. Now it should work!

view sourceprint?
$ ulimit -n
9216

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值