Что происходит, когда у сервера заканчиваются файловые дескрипторы

Сервер внезапно перестал отвечать, а в логах ошибка Too many open files? Дело не в нехватке памяти или перегруженном процессоре — просто ваш процесс исчерпал свои файловые дескрипторы. Под катом расскажу, что это такое, почему они заканчиваются, как быстро обнаружить проблему и как её пофиксить. Читать

https://habr.com/ru/companies/ruvds/articles/1007534/

#linux #too_many_open_files #файловые_дескрипторы #ulimit #systemd #lsof #мониторинг #LimitNOFILE #системное_администрирование #ruvds_статьи

Что происходит, когда у сервера заканчиваются файловые дескрипторы

Сервер внезапно перестал отвечать, а в логах ошибка Too many open files? Дело не в нехватке памяти или перегруженном процессоре — просто ваш процесс исчерпал свои файловые дескрипторы. Под катом...

Хабр

On my machine this looks as follows:

$ lsof [email protected]
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
firefox-e 98732 rtn 222u IPv4 1138297 0t0 TCP desktop:60092->lb-140-82-121-3-fra.github.com:https (ESTABLISHED)

#lsof

As a bonus I found out that firefox doesn't immediately close connections.

E.g.

1. start a fresh firefox (or make sure the host isn't used anywhere)
2. run `lsof [email protected]`, should be empty
3. go to github.com in firefox
4. run `lsof [email protected]`, should show a couple of connections
5. close the tab in firefox
6. repeating lsof command produces the same output for at least a minute

#lsof #firefox

I was fiddling around with lsof and it's quite powerful. Did you know you can use -i@host to find open connections to a particular host?

So if you wanted to check open connections to github.com you'd do `lsof [email protected]`.

#lsof

The #lsof tool can be useful, but the amount of options is overwhelming. Collecting the ones that I would use, so that I don't have to look things up next time.

Another cheat sheet to simplify the life of a #sysadmin running #linux

https://linux-audit.com/cheat-sheets/lsof/

Do you have other ones that you on a regular basis and that I missed?

lsof cheat sheet

Get information about open files on Linux using the lsof command. This cheat sheet covers many common uses for using lsof and how to use it.

Linux Audit

Updated the article: Monitor file access by Linux processes

Linux is powerful with the help of small utilities like lsof and strace. They help with monitoring disk and file activity, of new and running processes. #linux #lsof #ltrace #strace #syscall

Link: https://linux-audit.com/monitor-file-access-by-linux-processes/

Feedback and boosts welcome 🤟

Linux Audit

Linux is powerful with the help of small utilities like lsof and strace. They help with monitoring disk and file activity, of new and running processes.

Linux Audit

The moment when some maintainer releases a new version on a hunch that a literal white space issue in some change log file breaks an unit test and thus releases a new version of which the only change is changing some spaces to tabs … ✅

#lsof 4.99.3

GitHub - sveinbjornt/Sloth: Mac app that shows all open files, directories, sockets, pipes and devices in use by all running processes. Nice GUI for lsof.

Mac app that shows all open files, directories, sockets, pipes and devices in use by all running processes. Nice GUI for lsof. - sveinbjornt/Sloth

GitHub