I am trying to find the reason why my long-running app sometimes busts the maximum open file descriptor limit (ulimit -n
). I would like to periodically log how many file descriptors the app has open so that I can see when the spike occurred.
I know that lsof
includes a bunch of items that are excluded from /proc/$PID/fd
... Are those items relevant with regard to the open file descriptor limit? I.e. should I be logging info from lsof
or from /proc/$PID/fd
?
sysctl fs.file-nr | awk ' { print $3 } '