WLS_038:常见故障之六:Too many open files

声明:该博文转自http://maping930883.blogspot.com,热爱java,热爱生活

1. 典型现象
抛出异常java.io.IOException: Too many open files。
由于每打开一个文件,都有可能占用一个Socket连接,最终会导致用户正常的请求无法处理,导致Server Hang住。

2. 产生原因
一般来说,WebLogic Server不会打开太多文件,一般都是应用自身的问题。比如创建了很多临时文件:
java.io.IOException: Too many open files
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1314)
at java.io.File.createTempFile(File.java:1402)
at java.io.File.createTempFile(File.java:1439)
at troubleshooting.servlets.TooManyOpenHandles.service(TooManyOpenHandles.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

3. 诊断步骤

(1)使用Handle查看进程打开的所有文件信息。比如:handle -p java.exe >output.txt,查看所有java.exe打开的文件。
如果发现大量的临时文件,说明程序有问题:
bfc: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16794.hnd
c00: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16795.hnd
c04: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16796.hnd
c08: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16797.hnd
c0c: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16798.hnd
c10: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16799.hnd
c14: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16800.hnd
c18: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16801.hnd
c1c: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16802.hnd
c20: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16803.hnd
c24: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16804.hnd
c28: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16805.hnd
c2c: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16806.hnd
c30: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16807.hnd
c34: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16808.hnd
c38: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16809.hnd
c3c: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16810.hnd
c40: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16811.hnd
c44: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16812.hnd
c48: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16813.hnd
c4c: File C:\DOCUME~1\pma\LOCALS~1\Temp\WLSFileHandle16814.hnd
关于Handle的详细说明,请参考《使用Handle查看进程打开的文件》。

(2)使用Process Explorer 查看进程的信息,包括进程打开的文件总数。

你可能感兴趣的:(File)