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

[BUG][code-analyzer] EMFILE: too many open files #1740

Open
DougMidgley opened this issue Feb 5, 2025 · 6 comments
Open

[BUG][code-analyzer] EMFILE: too many open files #1740

DougMidgley opened this issue Feb 5, 2025 · 6 comments

Comments

@DougMidgley
Copy link

Have you tried to resolve this issue yourself first?

Yes

Bug Description

When running code-analyzer,

sf code-analyzer run --severity-threshold 2 --output-file codescan/result-scan.csv -w ./common/**

I receive the following message
Error (1): EMFILE: too many open files, open 'C:\Users\douglas.midgley\AppData\Local\sf\node_modules\@salesforce\plugin-code-analyzer\node_modules\@salesforce\code-analyzer-regex-engine\package.json'

Output / Logs

sfca-1738766366144.log

Steps To Reproduce

sf code-analyzer run --severity-threshold 2 --output-file codescan/result-scan.csv -w ./common/**

Expected Behavior

code-analyzer runs without error

Operating System

Windows 11

Salesforce CLI Version

@salesforce/cli/2.73.9 win32-x64 node-v20.11.0

Code Analyzer Plugin (code-analyzer) Version

@salesforce/sfdx-scanner 4.6.0 (4.6.0) code-analyzer 5.0.0-beta.0 (5.0.0-beta.0) dev 2.4.2 lightning-flow-scanner 2.34.0 (2.34.0)

Node Version

v20.11.0

Java Version

openjdk version "17.0.11" 2024-04-16 LTS OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)

Python Version

No response

Additional Context (Screenshots, Files, etc)

No response

Workaround

No response

Urgency

Low

@jfeingold35
Copy link
Collaborator

@DougMidgley it looks like this error is coming from the Regex engine specifically. Can you please run the command again with the -r regex flag to run only the Regex engine rules, so we can see whether it's because of that engine in isolation or because of its interaction with other engines?
Thanks!

@DougMidgley
Copy link
Author

@jfeingold35 -r regex flag returns same result

@jfeingold35
Copy link
Collaborator

Thanks for confirming. Do you have any idea how many files are encompassed by /common/**? I'd like to try and reproduce this locally if I can.

@DougMidgley
Copy link
Author

Hy @jfeingold35
Overall, 12000 records :) thats of all types.

@jfeingold35
Copy link
Collaborator

@DougMidgley , yup, that's a lot.
I'll spend some time trying to reproduce this, and I'll keep you posted as and when new information becomes available.

@jfeingold35
Copy link
Collaborator

@DougMidgley , in the meantime, you can work around this bug by just disabling the Regex engine altogether, which you would do by modifying your code-analyzer.yml file so that the engines>regex>disable_engine property is set to true. E.g.,

engines:
    regex:
        disable_engine: true

Once we have a published, you can revert that change to re-enable the engine.

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