|
| Problem | This technote explains how to debug the Too many open files error message on Windows®, AIX®, and Solaris Operating System™. When this message is written to the logs, it indicates that all available file handles for the process have been used. In a majority of cases, this is the result of file handles being leaked by some part of the application. This technote explains how to collect output that identifies what file handles are in use at the time of the error condition. | | Cause | System configuration limitation. | | Solution |
WindowsBy default, Windows does not ship with a tool to debug this type of problem. However, there is a freeware tool called Process Explorer that you can download from the following URL:http://www.sysinternals.com/ntw2k/freeware/procexp.shtml
This tool identifies the open handles associated with the Java™ process and determines which handles are being opened, but not closed. These handles result in the Too many open files error message.
It is important that you change the Refresh Rate. Select View > Update Speed, and change it to 5 seconds. There is also a utility called Handle that you can download from the following URL: http://www.sysinternals.com/ntw2k/freeware/handle.shtml
This tool is a command line version of Process Explorer. The URL above contains the usage instructions. AIXTo determine if the number of open files are growing over a period of time, issue lsof to report the open files against a PID on a periodic basis. For example:lsof -p (PID of process) -r (interval in seconds, 1800 for 30 minutes) > lsof.out This output does not give the actual file names to which the handles are open. It provides only the name of the filesystem (directory) in which they are contained. The lsof command indicates if the open file is associated with an open socket or a file. When it references a file, it identifies the file system and the inode, not the file name.
Run the following command to determine the file name:
# df -kP filesystem_from_lsof | awk '{print $6}' | tail -1 note the filesystem name
# find filesystem_name -inum inode_from_lsof -print shows the actual file name
To increase the number, change or add the nofiles=XXXXX parameter in the /etc/security/limits file, or by using the command: huser nofiles=XXXXX user_id
You can also use svmon:
# svmon -P java_pid -m | grep pers (this opens files in the format: filesystem_device:inode)
Use the same procedure as above for finding the actual file name. SOLARISRun the following commands to monitor open file (socket) descriptors on Solaris:
- ulimit -a > ulimit.out
- /usr/proc/bin/pfiles [PID of process that has too many open files]> pfiles.out
- lsof -p [PID of process that has too many open files]> lsof.out
- To determine if the number of open files is growing over a period of time, issue lsof to report the open files against a PID on a periodic basis. For example:
lsof -p (PID of process) -r (interval in seconds, 1800 for 30 minutes) > lsof.out
Sample output of lsof.out: COMMAND PID NODE NAME
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
java 6116 2640007 /WebSphere/AppServer/eAAS/debug.log
After analyzing the above collected data, if you need to increase the limit for number of open file descriptors, run the following command: ulimit -n nnnn (Where is nnnn is the desired number of open files) Other lsof informationIf lsof is not installed on your system, you can go to the URL below to get a copy: http://www-1.ibm.com/support/docview.wss?uid=swg21115219lsof is available for the following operating systems:- AIX 4.3.[23], 5L, and 5.1
- HP-UX 11.00 and 11.11
- Linux® 2.1.72 and above for Intel-based systems
- Solaris 2.6, 7, 8, and 9
| |
| | |
| |
|
Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Java SDK Operating system(s): AIX, HPUX, Linux, Multi-Platform, Solaris, Windows Software version: 3.5, 4.0, 5.0, 5.1, 6.0 Software edition: Edition Independent Reference #: 1067352 IBM Group: Software Group Modified date: 2004-07-06
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.
|