When I try to tail -f catalina.out
, I get the error:
tail: inotify cannot be used, reverting to polling: Too many open files
I tried the answer in this post: Too many open files - how to find the culprit
lsof | awk '{ print $2; }' | sort -rn | uniq -c | sort -rn | head
When I ran the above command, the output was
17 6115
13 6413
10 6417
10 6415
9 6418
9 6416
9 6414
8 6419
4 9
4 8
I don't see any process having 1024 files open. Isn't the number of files open 17,13,10,10,9? Or am I understanding it wrong? And all these were bash,sshd,apache2, tomcat had number 4.
I also did lsof | grep tail | wc -l
which returned 20
.
These numbers aren't huge, so why does tail -f catalina.out
fail?
tail
message was slightly different:tail: inotify resources exhausted
.This answer helped me.
You can also use
sudo sysctl -w fs.inotify.max_user_watches=1048576 && sysctl -p
to test if it helps without permanently modifying it.This post also helps https://nefaria.com/2014/08/tail-inotify-resources-exhausted/
– Ruslan Stelmachenko Oct 02 '17 at 18:27fs.inotify.max_user_instances=1048576
– Supernormal Apr 16 '23 at 19:59