Audit linter files if they spawn too many processes
See original GitHub issue(Updated description after analysis)
Based on PR #12105, we should audit other linter files and make sure this pattern does not exist anywhere else i.e disallow spawning of too many processes for each file to be linted, because it’s a bad practice and unnecessarily increases the runtime of lint checks.
Method of Analysis: Not all linter files spawn processes in the above manner, so I started by searching for subprocess
keyword in these files to look for this possibility.
- If the keyword is found, I looked at how processes are being created.
- If keyword not found, then I tried to understand on a high level how files are being lint without going into the “logic” part of the linter, and checked for similar behaviour - by looking into their
perform_lint_checks
or similar functions.
Linter files to be audited (with analysis/PR fixing them):
-
codeowner_linter.py
- No such pattern found. -
css_linter.py
- fixed via #12105 -
general_purpose_linter.py
- No such pattern found. -
html_linter.py
- fixed via #12129 -
js_ts_linter.py
- Correct pattern already exists. It creates only one process to lint all files as shown below in code: https://github.com/oppia/oppia/blob/1fd68c5a2d1c0c47d44d442455c5fe7e434da633/scripts/linters/js_ts_linter.py#L1121-L1123 -
other_files_linter.py
- No such pattern found. -
pre_commit_linter.py
- No such pattern found. -
python_linter.py
- No such pattern found.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Spawn of a lot python processes · Issue #3586 - GitHub
Expected behaviour When a save is done, some linting process are created. After the save and the linting they should be gone.
Read more >multiprocessing.Pool spawns too many threads - Stack Overflow
Therefore the assumption, that only as many hardware threads as the number of processes specified in the Pool constructor, is invalid. If ...
Read more >Process Injection - Threat Detection Report - Red Canary
Process Injection enables adversaries to execute potentially suspicious processes in the context of seemingly benign ones.
Read more >Does anyone know a simple way to monitor root process spawn
always Allocate an audit context, always fill it in at syscall entry time, and always write out a record at syscall exit time....
Read more >Docker Machine Executor autoscale configuration - GitLab Docs
GitLab Runner can autoscale, so that your infrastructure contains only as many build instances as are necessary at any time. If you configure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sajalasati Thanks for sharing the method, it works for all the cases except the
python_linter.py
as we use linter modules to run pylint/isort checks, can you audit thepython_linter
file again and update the issue accordingly? 😃This appears to be done