Apache Tomcat异常-打开的文件太多 [英] Apache Tomcat Exception - Too many open files

查看:993
本文介绍了Apache Tomcat异常-打开的文件太多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在Amazon Linux的Apache Tomcat中运行Web服务.最初,Web服务运行正常.发出超过1000个Web请求后,我们收到太多打开文件异常.同样,当我们重新启动tomcat服务器时,将解决此问题.

We are running a web service in Apache Tomcat in Amazon Linux. Initially web-service is running properly. We are getting too many open files exception after making more than 1000 web request. Again this issue will be resolved when we re start the tomcat server.

请在例外下面找到

25-Apr-2016 10:05:52.628 SEVERE [http-nio-8080-Acceptor-0] org.apache.tomcat.util.net.NioEndpoint$Acceptor.run Socket accept failed
 java.io.IOException: Too many open files
        at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
        at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
        at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:686)
        at java.lang.Thread.run(Thread.java:745)

PS:我们不在Web服务中进行任何与文件相关的操作.

PS : we are not doing any file related operations in the web service .

推荐答案

打开文件似乎有一些限制.当您在Linux上运行时,我怀疑您的文件描述符已用完.

It looks like, that there is some limit on open files. As you are running on Linux I suspect you are running out of file descriptors.

签出ulimit命令以查看允许打开的文件数.

Check out ulimit command to see the number of allowed opened files.

ulimit -n

您可以通过编辑来更改打开的文件数:

You can change the number of open files by editing:

/etc/security/limits.conf

并添加如下内容:

* soft nofile 4096
* hard nofile 4096

您可以在此处中查看更多有关limit.conf的信息.

You can check more about limits.conf here.

默认限制为1024,对于某些Java应用程序来说可能太低.

The default limit is 1024 and can be too low for some Java applications.

有关增加最大打开文件数的更多信息,请参见:

More information about increasing the maximum number of open files in this article: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

这篇关于Apache Tomcat异常-打开的文件太多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆