Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit 1024 on Linux tells that entr is not using inotify #11

Closed
abitrolly opened this issue Oct 12, 2019 · 9 comments
Closed

Limit 1024 on Linux tells that entr is not using inotify #11

abitrolly opened this issue Oct 12, 2019 · 9 comments

Comments

@abitrolly
Copy link

I try to set a build watcher for tflint and get hit by 1024 limit.

$ fd "\.go$" | entr go build -o ./flt
entr: Too many files listed; the hard limit for your login class is 1024. Please consult
http://eradman.com/entrproject/limits.html

But my limit is 8192.

$ cat /proc/sys/fs/inotify/max_user_watches  
8192

entr does not use inotify. Why?

@abitrolly
Copy link
Author

The same error occurs when trying to watch directories with

$ fd "\.go$" | entr -d go build -o ./flt

But there are only 64 directories to watch.

$ fd -t d | wc -l

Using inotify with dir monitoring and custom filters could expand watching limits without changes to core system configuration.

@eradman
Copy link
Owner

eradman commented Oct 12, 2019

The error you're seeing is caused by hitting the maximum number of file descriptors. inotify can monitor multiple files per file descriptor, but entr uses one file descriptor per file because this is the way kqueue on BSD and Mac works. This was a compromise to make entr portable.

To raised this limit, edit /etc/security/limits.conf

*       hard    nofile  16384
*       soft    nofile  16384

How many total files/directories are you monitoring?

@abitrolly
Copy link
Author

Why entr can not use "multiple files per descriptor" interface setting limit of files to 1 if kqueue is used?

How many total files/directories are you monitoring?

About 1024.

$ fd "\.go$" | wc -l
1024

@eradman
Copy link
Owner

eradman commented Oct 13, 2019

You are asking a good question--it would be better if users never needed to adjust the default resource limits. I will look into modifying entr to add the list of input files to a single inotify queue.

@abitrolly
Copy link
Author

Thank you. entr is an awesome tool that I use constantly, and because it is available from major distros, it is easy to use. I'm looking forward to the new version. :D

On a side note, there is a new fanotify mechanism in Linux 5.1 which may or may not be more efficient.

@eradman
Copy link
Owner

eradman commented Oct 15, 2019

Thanks for the kind words!

I uploaded a change for making better use of inotify in commit 9737442. This will respect limits set by /proc/sys/fs/inotify/max_user_watches

@eradman
Copy link
Owner

eradman commented Oct 24, 2019

Updated the documentation limits on LInux at
file:///home/eradman/www/eradman.com/entrproject/limits.html

@eradman eradman closed this as completed Oct 24, 2019
@abitrolly
Copy link
Author

Looks good. Just two fixes for http://eradman.com/entrproject/limits.html#linux

s/permement/permanent/
s/was required //

@eradman
Copy link
Owner

eradman commented Oct 24, 2019

Good catch! Text adjusted. Thanks @abitrolly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants