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

Obey the open file descriptor limit when grouping files #200

Merged
merged 1 commit into from
Jun 4, 2023

Conversation

th1000s
Copy link
Contributor

@th1000s th1000s commented May 10, 2023

Given enough CPU cores and the multiplication factor fclones uses, the number of threads and therefore approximately the maximum number of open files can exceed the usual limit of 1024 on Linux. On macOS this tends to be even lower.

Then some of the "fetch file extents mapping" and "compute hash of file" steps fail with "Too many open files (os error 24)".

To fix this, retrieve the current limit, increase it if possible and stay below it.

Only used on Unix systems.

@th1000s
Copy link
Contributor Author

th1000s commented May 10, 2023

This is set globally and not in main(), so this can't be changed when using fclones as a library.

Two local variables, in group/file, could also be used before threads are created, but then the counter would have to be passed into various functions.

Given enough CPU cores and the multiplication factor fclones uses, the
number of threads and therefore approximately the maximum number of open
files can exceed the usual limit of 1024 on Linux. On macOS this tends
to be even lower.

Then some of the "fetch file extents mapping" and "compute hash of file"
steps fail with "Too many open files (os error 24)".

To fix this, retrieve the current limit, increase it if possible and
stay below it.

Only used on Unix systems.
Copy link
Owner

@pkolaczk pkolaczk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@pkolaczk pkolaczk merged commit 5d12978 into pkolaczk:main Jun 4, 2023
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

Successfully merging this pull request may close these issues.

2 participants