Centos – How to determine if file descriptor issue occurred

centosfilesystemstcp

My webserver/app server (apache/tomcat) running on CentOS, hung this morning. At the time of the hang I noticed a large number of sockets in either the TIME_WAIT or CLOSE_WAIT state. I'm trying to figure out how to more definitively determine if the hang was caused by hitting a max # of file descriptors and if so, if it was a per process limit, per user limit, or overall os limit. What os tje best to make that determination?

Best Answer

sysctl fs.file-nr

From this command you will get 3 numbers. First is the number of used file descriptor the second is the number of allocated but not used file descriptor and the last is the system max file descriptor.

Another way of checking process based fd information is

cat /proc/pid/limits 

You can check all kind of limits for this process including max open files.

This might be a good place to start investigation for fd related issues