调试“打开的文件太多”问题 [英] Debugging the "Too many files open" issue

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

问题描述

我正在处理的应用程序突然崩溃

The application i am working on suddenly crashed with

java.io.IOException: ... Too many open files

据我所知,这意味着文件已经打开但未关闭。

As i understand the issue it means that files are opened but not closed.

Stacktrace当然是在事后发生的,只能帮助理解发生了什么事件错误。

Stacktrace of course happens after the fact and can only help understand before what event error occurred.

什么会是一种搜索代码库的智能方法,可以在应用程序处于高压力负载时发现这个问题。

What would be an intelligent way to search your code base to find this issue which only seems to occur when app is under high stress load.

推荐答案

我认为使用专门为此目的设计的工具的最佳方式,例如这一个

I think the best way to use a tool specifically designed for the purpose, such as this one:


这个小Java代理是一个工具,可以跟踪JVM中何处/何时/谁打开文件。您可以让代理跟踪这些操作以查找访问模式或处理泄漏,并转储当前打开的文件列表以及打开它们的位置/时间/谁。

This little Java agent is a tool that keeps track of where/when/who opened files in your JVM. You can have the agent trace these operations to find out about the access pattern or handle leaks, and dump the list of currently open files and where/when/who opened them.

此外,在太多打开文件异常时,此代理将转储列表,允许您找出正在使用大量文件描述符的位置。

In addition, upon "too many open files" exception, this agent will dump the list, allowing you to find out where a large number of file descriptors are in use.

我好像记得 YourKit 也有一些设施这个,但目前找不到任何具体信息。

I seem to remember YourKit also having some facilities around this, but can't find any specific information at the moment.

这篇关于调试“打开的文件太多”问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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