Skip to content

Purge programs once they are done #1718

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

Open
sheetalkamat opened this issue Mar 11, 2020 · 2 comments
Open

Purge programs once they are done #1718

sheetalkamat opened this issue Mar 11, 2020 · 2 comments
Labels
blocked by another issue Issues which are not ready because another issue needs to be resolved first enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree performance Issues regarding performance

Comments

@sheetalkamat
Copy link
Contributor

What code were you trying to parse?

// Put your code here

What did you expect to happen?

What actually happened?

Versions

package version
@typescript-eslint/typescript-estree X.Y.Z
TypeScript X.Y.Z
node X.Y.Z
npm X.Y.Z

have chatted with @uniqueiniquity offline about this but once the files from the program are done, it is ok to close the watch so we can release program and its resources.. The common scenario is to have files in one tsconfig to be in a folder so likely to be iterated over together so it is possible to remoe the programA when files from programB are being queried and all the files (except say external files and lib files) are already iterated over.. Just need to keep track of files iterated.. The worst thing that can happen is to recreate program. (we would also keep flag if the program is recreated so that it is not purged after that so editing scenario keeps programs for the files being edited if that's how eslint works in editor scenario.. Needs some experimenting)

But this is the way we can work around the OOMs when there are multiple tsconfigs to be linted..
This is what will help issue reported at microsoft/TypeScript#35676 as just sharing source file wont be enough as that fix would delay OOM from say 5 projects to 6/7 but still not solve the main problem of having to create so many programs and create types

@sheetalkamat sheetalkamat added package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for team members to take a look labels Mar 11, 2020
@bradzacher bradzacher added enhancement New feature or request performance Issues regarding performance and removed triage Waiting for team members to take a look labels Mar 11, 2020
@bradzacher
Copy link
Member

The worst thing that can happen is to recreate program

If this happens during a CLI run, it would add lot of runtime, so it's definitely a worst-case scenario.
OTOH, potentially not as bad for the IDE case.


This seems reasonable, and would save a bunch of memory provided that ESLint is deterministic in how it asks us to parse files. We'll have to have a look into how ESLint globs for files and traverses the directory tree.

Worst case here we could create a thin wrapper around ESLint to give us the deterministic order, though I would prefer to avoid introducing extra tools into the ecosystem unless absolutely required.


I've thought about this before, but I didn't explore it because there's some complexities around handling the persistent IDE use case.

Well, I guess that's more of a question - would there be complexities?

There's one I can see: if the user opened a bunch of random files across every single program, then we wouldn't know to clean up the programs, so you'd quickly get into the same high-memory/OOM state. Though I think VSCode has a higher OOM threshold than node, it's still a bad situation - so we'd need to have an additional heuristic (time based?) to determine when we can dump a program in these cases.

A super duper rare edge-case would be if a user opens every single file in a program within their IDE, we'd detect the program is "complete", and then clean it up. Then if they save one of those files, we'd have to recreate the program.

Do you know how VSCode works in these instances? Do they create and destroy programs as required, or do they keep them all around in memory?

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Feb 23, 2022

Marking this as 'awaiting response' 'blocked by another issue' in that bradzacher's questions will be answered by finishing #4183.

@JoshuaKGoldberg JoshuaKGoldberg added blocked by another issue Issues which are not ready because another issue needs to be resolved first and removed awaiting response Issues waiting for a reply from the OP or another party labels Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by another issue Issues which are not ready because another issue needs to be resolved first enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree performance Issues regarding performance
Projects
None yet
Development

No branches or pull requests

3 participants