Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
85
rated 0 times [  85] [ 0]  / answers: 1 / hits: 248605  / 3 Years ago, fri, may 7, 2021, 3:31:38

When running tail -f filename, I got the following message:



tail: inotify cannot be used, reverting to polling: Too many open files


Is that a potential problem?



How do I diagnose what's responsible for all the open files? I have a list of suspect processes, but if they don't turn out to be the culprits, instructions that don't rely on knowing which process to check would be useful.


More From » filesystem

 Answers
7

You can use lsof to understand who's opening so many files. Usually it's a (web)server that opens so many files, but lsof will surely help you identify the cause.


Once you understand who's the bad guy you can



  • kill the process/stop the program

  • raise the ulimit


If output from lsof is quite huge try redirecting it to a file and then open the file


Example (you might have to Ctrl+C the first command)


lsof > ~/Desktop/lsof.log
cat ~/Desktop/lsof.log | awk '{ print $2 " " $1; }' | sort -rn | uniq -c | sort -rn | head -20
vim ~/Desktop/lsof.log

[#35903] Friday, May 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fertion

Total Points: 436
Total Questions: 121
Total Answers: 156

Location: England
Member since Sun, May 21, 2023
1 Year ago
;