On Mon, 2012-01-23 at 05:33 -0800, gnath wrote:
> Hello Robert, 
> 
> 
> We are talking about an app which has been grown since years and now migrated 
> to Tomcat. Most of the main code is migrated to use spring jdbc and spring 
> 3.0 mvc. 
> Would you recommend some way that i can spot the issue from inspecting the 
> open file descriptors once the server hangs/crashes so that i can check the 
> code to see what you are saying? Please do let me know.

Try running FindBugs on your code.  In most cases, it will detect when
you do not correctly close a file.

Dan


> 
> 
> All, please help if you can give me any hints from the information i provided 
> down below.
> 
> 
> Thanks
> -G
> 
> 
> 
> ________________________________
>  From: Purvis Robert (NHS CONNECTING FOR HEALTH) <robert.pur...@nhs.net>
> To: Tomcat Users List <users@tomcat.apache.org>; gnath 
> <gautam_exquis...@yahoo.com> 
> Sent: Monday, January 23, 2012 1:32 AM
> Subject: RE: Tomcat 6.0.35-SocketException: Too many open files  issue with
>  
> Sorry to possibly state the obvious, but are there perhaps files that are not 
> being closed?
> 
> This can often happen if code goes into a "catch", and a file is not closed. 
> Best to have a "finally" block which checks if a file is open, and closes it.
> 
> 
> Robert Purvis
> 
> -----Original Message-----
> From: gnath [mailto:gautam_exquis...@yahoo.com]
> Sent: 22 January 2012 08:01
> To: users@tomcat.apache.org
> Subject: Tomcat 6.0.35-SocketException: Too many open files issue with
> 
> Hello,
> 
> We have been seeing "SocketException: Too many open files" in production 
> environment(Linux OS running Tomcat 6.0.35 with sun's JDK 1.6.30) every day 
> and requires a restart of Tomcat. When this happened for the first time, we 
> searched online and found people suggesting to increase the file descriptors 
> size and we increased to 4096. But still the problem persists.  We have the 
> Orion App Server also running on the same machine but usually during the day 
> when we check the open file descriptor by command: ls -l /proc/PID/fd, its 
> always less than 1000 combined  for both Orion and Tomcat.
> 
> 
> Here is the exception we see pouring in the logs once it starts: This 
> requires us to kill java process and restart tomcat. Our Tomcat configuration 
> maxThreadCount is 500 with minSpareThreads=50 in server.xml
> 
> 
> SEVERE: Socket accept failed
> java.net.SocketException: Too many open files
>         at java.net.PlainSocketImpl.socketAccept(Native Method)
>         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
>         at java.net.ServerSocket.implAccept(ServerSocket.java:462)
>         at java.net.ServerSocket.accept(ServerSocket.java:430)
>         at 
> org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
>         at 
> org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:352)
>         at java.lang.Thread.run(Thread.java:662)
> 
> ulimit -a gives for the user where Tomcat is running.
> 
> 
> open files                      (-n) 4096
> 
> 
> Please let me know what could be the issue here and how can i resolve this 
> 'Too many open files' issue.
> 
> Thanks
> -G
> 
> ********************************************************************************************************************
> 
> This message may contain confidential information. If you are not the 
> intended recipient please inform the
> sender that you have received the message in error before deleting it.
> Please do not disclose, copy or distribute information in this e-mail or take 
> any action in reliance on its contents:
> to do so is strictly prohibited and may be unlawful.
> 
> Thank you for your co-operation.
> 
> NHSmail is the secure email and directory service available for all NHS staff 
> in England and Scotland
> NHSmail is approved for exchanging patient data and other sensitive 
> information with NHSmail and GSi recipients
> NHSmail provides an email address for your career in the NHS and can be 
> accessed anywhere
> For more information and to find out how you can switch, visit 
> www.connectingforhealth.nhs.uk/nhsmail
> 
> ********************************************************************************************************************

Reply via email to