D
D
Dmitry2017-02-16 23:20:46
linux
Dmitry, 2017-02-16 23:20:46

How to reduce the number of open descriptors that are displayed by the fs.file-nr parameter?

Actually a subject. I ask you to tell me how to find a process that has gobbled up an incredibly large number of open file descriptors? Maybe with the help of lsof, ps?
example from real life:

cat /proc/sys/fs/file-nr
5927920	0	6577798

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Maksimov, 2017-02-17
@ValorVl

Here, from memory, I quickly sprinkled it, crookedly, but you caught the essence, I think.

#!/bin/bash

for i in `ps aux --no-header | awk '{print $2}'` ; 
do
        echo `lsof -p $i | wc -l` " - " `lsof -p $i | awk '{print $1}'`
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question