• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question Too many open files..

tkalfaoglu

Silver Pleskian
Server operating system version
Alma Linux 8.8
Plesk version and microupdate number
Obsidian
I wrote a little chron thing that warns me when there are too many open files (which can be fatal on the server)..
I got a warning at 4 AM..

The open files number comes from /proc/sys/fs/file-nr, the 42 thousand..

Apparently my script that lists the open files doesn't work as well as I hoped -- it's missing lots of things as it only found ~15K files.

Anyway, what could be the cause of too many open files?

Many thanks,
-t


It says:

3 Jun 2023 04:05:02 current open files at 42016

108 (sd-pam)
130 /usr/libexec/postfix/master
142 smtpd
202 dovecot/imap-login
240 /opt/plesk/php/8.0/bin/php-cgi
244 /usr/sbin/dovecot
252 Passenger
267 dovecot/imap
267 dovecot/imap
386 php-fpm:
408 /opt/plesk/php/7.4/bin/php-cgi
423 /usr/lib/systemd/systemd
1983 /usr/libexec/mysqld
3217 /usr/sbin/httpd
4856 nginx:
TOTAL: 14968
 
I'd need to see your script to get a better idea of why the output is different. Open files can change very quickly, so the script may be a millisecond too late and get fewer files than the alert got.

For example, this will tell you how many open files each process is using, but it will take a while to run, so the actual number will be different by the time it finishes:
Code:
lsof | awk '{ print $1 " " $2; }' | sort -rn | uniq -c | sort -rn | head -15
/proc/sys/fs/file-nr shows allocated file handles, not open files. These indicate whether a process has active connections to a file. A single process can assign multiple handles to the same file, so there can be multiple handles for a single file. This could be the reason for the 15K to 42K difference.
 
Back
Top