-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
tsserver crashes with large projects #7444
Comments
A quick solution I can think of:
Does that sound reasonable? |
the file number is not really the correct metric. maybe total file size, as there is a direct correlation between text size and AST size. |
Agreed. File count doesn't help much if you're loading a 10MB bundled/minified file. Let's chat in the room and see what we can come up with and report back... |
We had a chat, and he's what we're thinking... We'll accumulate the size of the source files as we load them, and if this exceeds some TBD limit (e.g. 20MB?), we'll add an error and stop loading files. There will be a compiler options Some pertinent details:
Thoughts? |
To reproduce this I have taken derived steps from microsoft/vscode#3170 which is on OS X this:
Note that Last create a |
@billti I like your suggestions.
Most important for VS Code is that the server does not crash and that the
To survive we need #1 and having #2 will make the experience even better. It is OK for us if #3 happens post 1.8.x |
If the error location is on the |
This may not be only memory issue. I've tried the repro @jrieken provides, with the ember server running, the TS language service would crash as mentioned; however after I shutdown the ember server, even with the same flies, the TS language service works normally. @jrieken can you give it a try as well? |
@zhengbli check out the |
I realized why I wasn't seeing file size changes between when server is running and when the server is not. There are many symlink files generated in the That also partially contributes to the crash, because when |
Thanks. We only use the number of files and show the warning the project has more than 500 files. We know it's not precise but it can be easily swapped with the trigger/diag event from this issue |
Status update:
We also added a compiler option called However, as we still process up to 20M of files, it could take a long time before the error was generated. Currently with the repro sample you gave, it took around 40 seconds to get intelligent pop-up (when the serve is running) on my i-5 machine (around 18 seconds to parse To summarize:
What's next:
I'll open a new issue for tracking this task items. |
Thanks. I can verify and that server doesn't crash anymore tho it is very slow... For now we will stay with our >500 files condition but are eagerly awaiting the new event. |
Moving it to 2.0 to see if we can do better on the recovery time. |
I am unsure if this is caused by TS eagerly loading all syntax trees or by the tsserver eagerly loading all symbols (which btw seems crazy to me) but I think the tsserver should check how large a project is (or how much memory is already used) and fail gracefully.
I have a JavaScript project with little code but a lots of dependencies like
node_modules
andbower_components
as well as files that get generated into atemp
folder (on server start). I am aware of the exclude-property and the default excludes, but the challenge is to provide guidance to the user to use them. I have no chance to ask tsserver how many files are included by a project because it crashes already with the firstopen-file
request.A diagnostics message ala
too many files (foo/jsconfig.json, files: [...]),
would be much appreciated because otherwise we are going to duplicate a lot of logic on our (VS Code) end for such checks (and the server will still crashes).The text was updated successfully, but these errors were encountered: