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

fix: EMFILE errors #18313

Merged
merged 10 commits into from Apr 17, 2024
Merged

fix: EMFILE errors #18313

merged 10 commits into from Apr 17, 2024

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Apr 10, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

File read operations that throw an EMFILE or ENFILE error will be automatically retried.

I also added a test that runs only in CI to save us time locally. There was an error with the abort handling that I had to fix in order to make the test pass.

fixes #18301

Is there anything you'd like reviewers to focus on?

@nzakas nzakas requested a review from a team as a code owner April 10, 2024 19:04
@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Apr 10, 2024
@github-actions github-actions bot added cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features github actions labels Apr 10, 2024
Copy link

netlify bot commented Apr 10, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 7550437
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/661ee4026b9de2000823b380

@fasttime fasttime added the accepted There is consensus among the team that this change meets the criteria for inclusion label Apr 11, 2024
lib/eslint/eslint.js Outdated Show resolved Hide resolved
@nzakas
Copy link
Member Author

nzakas commented Apr 11, 2024

I could use some help understanding what is going on with the lint error. Linting passes locally, so it's difficult for me to debug.

@nzakas
Copy link
Member Author

nzakas commented Apr 11, 2024

Looks like a bug in eslint-plugin-n:
eslint-community/eslint-plugin-n#242

mdjermanovic
mdjermanovic previously approved these changes Apr 15, 2024
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Leaving open for a couple of days if anyone else would like to review it before merging.

@fasttime
Copy link
Member

fasttime commented Apr 15, 2024

When the EMFILE test runs locally, it will create 100000 files in tests/fixtures/emfile. If I run npm test afterwards, the whole tests/fixture directory, including the new 100000 files, will be copied to a temporary directory multiple times, because some unit tests run on a temporary copy of the fixtures directory:

shell.cp("-r", "./tests/fixtures/.", fixtureDir);

shell.cp("-r", "./tests/fixtures/.", fixtureDir);

shell.cp("-r", "./tests/fixtures/.", fixtureDir);

sh.cp("-r", "./tests/fixtures/.", fixtureDir);

It seems unnecessary to copy those files, even if the EMFILE test will mostly run only in CI.

Would it be possible to delete the test files after the EMFILE test runs? Alternatively, we could create the files for the EMFILE test in a different directory in or in a temporary directory and run the test there.

@nzakas
Copy link
Member Author

nzakas commented Apr 15, 2024

Moved the file creation to tmp/emfile-check.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

Just a note about .gitignore, then LGTM.

.gitignore Outdated Show resolved Hide resolved
Co-authored-by: Francesco Trotta <github@fasttime.org>
@nzakas
Copy link
Member Author

nzakas commented Apr 16, 2024

@fasttime @mdjermanovic can you re-approve please?

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 0d8cf63 into main Apr 17, 2024
18 checks passed
@mdjermanovic mdjermanovic deleted the 18301 branch April 17, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features github actions
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Bug: Error: EMFILE: too many open files
4 participants