fix(cli): bump open files limit on macOS and Linux#2106
Conversation
5e0474d to
36de5a6
Compare
There was a problem hiding this comment.
Seems to work on my machine 👍
So just it's my little comment below.
this branch
➜ ~ prlimit --pid $(pgrep lychee) --nofile
RESOURCE DESCRIPTION SOFT HARD UNITS
NOFILE max number of open files 524288 524288 files
master
➜ ~ prlimit --pid $(pgrep lychee) --nofile
RESOURCE DESCRIPTION SOFT HARD UNITS
NOFILE max number of open files 1024 524288 files
|
I was reading the manual and this function increases the soft limit up to the hard limit of no. files, which is usually big enough. But is it possible that the hard limit is also a low number that would be too small for lychee? If that happens, we should probably lower max-concurrency to keep lychee functional, maybe with a warning. Do we know the relationship between max-concurrency and the number of used files? |
36de5a6 to
0f228c6
Compare
Yes, it is possible to get a low number and be none the wiser. :) And also yes, we should clamp the max concurrency accordingly. But the tricky part is: clamp to what? I was roughly calculating Added a change for that. |
53f3c2f to
b5f68c2
Compare
b5f68c2 to
a1f29c3
Compare
|
Also added a regression test. |
|
I've double checked the open file descriptors on my machine and it was 18 (in idle mode with I also tried to improve the docs and I now try to read the limit if setting it fails. See 12d4174. Previously, you divided by 2. |
d1b49ac to
12d4174
Compare
|
Thanks for the review and for the improvements @thomas-zahner. :) |
|
Awesome, thanks for fixing this tricky issue! |
|
Well, let's see if we fixed it. But thanks. :) |
This automatically bumps the maximum number of open files (NOFILE) to the hard limit.
It prevents 'Too many open files (os error 24)' which happens easily on macOS due to its low default soft limit (256).
It addresses the issue originally mentioned in the comments, where users experience this during initial link extraction or link checking across multiple files.
Fixes #1248