Skip to content

High CPU and memory usage on tsserver #26968

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

Closed
mjbvz opened this issue Sep 7, 2018 · 6 comments
Closed

High CPU and memory usage on tsserver #26968

mjbvz opened this issue Sep 7, 2018 · 6 comments
Labels
Fixed A PR has been merged for this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Sep 7, 2018

From @Maistho on September 7, 2018 21:16

  • VSCode Version: insiders 1.28
  • OS Version: linux 4.18
    Steps to Reproduce:
  1. Open my workspace, which has a large number of files in it (easily over 100k, but most files are ignored using files.watcherExclude).
  2. Watch as vscode uses up a single thread fully, and leaks memory as well.

The offending process has the following commandline:

/opt/visual-studio-code/code /opt/visual-studio-code/resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --enableTelemetry --cancellationPipeName /tmp/vscode-typescript/tscancellation-719f90a578cb559ea657.tmp* --logVerbosity verbose --logFile /home/maistho/.config/Code/logs/20180907T230457/vscode.typescript-language-features_1/tsserver-log-O8pOZR/tsserver.log --locale en --noGetErrOnBackgroundUpdate

Does this issue occur when all extensions are disabled?: Yes

I have uploaded logs from my session with the following ID:
Log file ID: 3308023914

Let me know if there's anything I can try to debug this.

Copied from original issue: microsoft/vscode#58223

@mjbvz
Copy link
Contributor Author

mjbvz commented Sep 7, 2018

@Maistho Can you please describe the general structure of your project. Do you have jsconfig.json or tsconfig.json files? About how many js/ts files do you have?

@sheetalkamat I don't see anything suspicious in the logs. The last line is:

Info 40   [23:5:5.105] DirectoryWatcher:: Added:: WatchInfo: /home/user/project/path 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution

@sheetalkamat
Copy link
Member

Since the project was opened with projectRootPath as /home/user/project/path we will watch that for any location that is inside it and hence the whole directory is watched recursively. With #25811 we changed that to watch sub directory and I think that it might help with that. @Maistho can you please try with typescript@next and see if that helps?

@Maistho
Copy link

Maistho commented Sep 10, 2018

@mjbvz I have 3+ tsconfig.json files, and a bunch of data files in a ignored directory. Amount of js/ts files is a couple hundred.

@sheetalkamat Thanks for the quick reply! Using the latest version of vscode seems to solve the issue!


What I did:

yarn add -D typescript@next

Then in vscode settings.json, add:

  "typescript.tsdk": "./node_modules/typescript/lib"

@sheetalkamat sheetalkamat added the Fixed A PR has been merged for this issue label Sep 10, 2018
@sheetalkamat
Copy link
Member

Probably #25811 fixed this.

@alexmccabe
Copy link

alexmccabe commented Mar 14, 2019

I have been having this issue for months now, and sometimes it goes away with a restart. It occurs with all extensions disabled.

Running latest OSX and latest non-insiders build. I have produced a tsserver.log file, but our project isn't public so I'd rather not upload it publicly. Additionally we do not have a jsconfig.json nor tsconfig.json file in the project. It's getting so bad, I'm considering moving away from the editor, which is a shame because it's so nice otherwise.

This is not limited to just one project though.

@sheetalkamat
Copy link
Member

@alexmccabe Can you please open new issue with your repro details. You can share log confidentially on Microsoft servers if your company allows that.
I would also recommend using typescript nightly drop to ensure that you are verifying with latest typescript build.

You can upload logs by following these steps:

  1. With "typescript.tsserver.log": "verbose" enabled
  2. Restart vscode or vscode insiders
  3. Reproduce the problem
  4. You can share the logs using
    • either by sharing logs in the folder that gets opened by running open tsserver log from command palette
      or
    • Run code --upload-logs on the command line (or code-insiders --upload-logs if using vscode insiders) and follow instructions and Then share the log file ID

We also have process to sign NDA if that's what is needed to look into repro, but tsserver log can be good first starting point of investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants