Skip to content

tsserver.js is eating CPU (100%) #20260

Closed

Description

  • VSCode Version: 1.9.1
  • OS Version: macOS Sierra

Steps to Reproduce:

  1. Open VS Code
  2. Run top -u
  3. Notice Code Helper is spiking to 80-100%

I ran the command ps -eo pcpu,user,pid,command | grep Code and this is the process spiking to 100%.

100.0 sam              37109 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/utils/electronForkStart /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/node_modules/typescript/lib/tsserver.js --useSingleInferredProject --enableTelemetry

// Benjamin Pasero (@bpasero) Johannes Rieken (@jrieken)

Activity

  1. bpasero commented on Feb 9, 2017

    @bpasero
    Contributor

    Sam Verschueren (@SamVerschueren) as usual we need a lot more details to understand why this happens.

  2. added
    freeze-slow-crash-leak
    on Feb 9, 2017
  3. SamVerschueren commented on Feb 9, 2017

    @SamVerschueren
    ContributorAuthor

    It happened after the upgrade. I restarted my mac and it looks like it's ok now. If it happens again, what information can I provide to make this debuggable? I disabled all my extensions so it was a clean VS Code.

  4. jrieken commented on Feb 9, 2017

    @jrieken
    Contributor

    Any chance you can share that project with us?

  5. pdfowler commented on Feb 9, 2017

    @pdfowler

    I've been tracking the same issue (also tsserver, same ps aux | grep PROC_ID results) for a few days now. I have a few interesting data points to share:

    • After quitting VSCode, and also when installing an upgrade, the high CPU process remains running, while another identical one spawns
    • After a while (~5 minutes?), the process returns to a normal CPU rate (0-1%)
    • I observed this behavior with VSCode in the background, after launching, then relaunching for update.

    Additionally, I have observed a "Code Helper has quit unexpectedly" system modal after an hour or so of use - I'll keep track of my current process IDs to see if it is the tsserver processes that are quitting

    cream:~ fatty$ ps aux | grep tsserver
    fatty            18370  98.5  5.3  4043036 448640   ??  R    11:11AM   0:46.21 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/utils/electronForkStart /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/node_modules/typescript/lib/tsserver.js --useSingleInferredProject --enableTelemetry
    fatty            17662  93.3  4.4  6466928 370412   ??  R    11:04AM   4:07.14 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/utils/electronForkStart /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/node_modules/typescript/lib/tsserver.js --useSingleInferredProject --enableTelemetry
    fatty            18416   0.0  0.0  2459428   2044 s003  S+   11:12AM   0:00.01 grep tsserver
    fatty            18371   0.0  0.4  3360196  32024   ??  S    11:11AM   0:04.15 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/out/utils/electronForkStart /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript/node_modules/typescript/lib/tsserver.js --useSingleInferredProject --enableTelemetry
    
  6. maxcan commented on Feb 17, 2017

    @maxcan

    I'm seeing this too.

    vs code 1.9.1
    typescript 2.1.6
    osx 10.12.2.

    will try a restart

  7. mjbvz commented on Feb 24, 2017

    @mjbvz
    Contributor

    Sorry for the delay following up on this issue.

    Sam Verschueren (@SamVerschueren) To help us investigate, please try collecting a trace of the TypeScript Server when this occurs. Here's information on to do this using the TSS_LOG environment variable: https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29#logging

    From a command line, run:

    $ export TSS_LOG="-level verbose -file /Users/${username-`whoami`}/tss.log"
    $ code 
    

    Reproduce the problem in VSCode and then share the tss.log file

    Let me know if you have any questions about this.

    Thanks

  8. added
    javascript
    typescript
    info-needed
    on Feb 24, 2017
  9. mjbvz commented on Mar 20, 2017

    @mjbvz
    Contributor

    Closing as we need the logs investigate this. Log collection should be simplified by #22914 for VSCode 1.11 but please provide logs using the environment variable approach mentioned until then

  10. mjbvz commented on Jul 19, 2017

    @mjbvz
    Contributor

    @teterovic Please open an new issue for this. Also please try collecting the TypeScript server logs. These logs contain detailed information about the time required to compute for each response:

    1. Set "typescript.tsserver.log": "verbose"
    2. Restart VSCode
    3. Reproduce the issue
    4. Run the Open TSServer log File command and view the tsserver.log file

    If you can share the ts log file I can take a look through them to see if anything stands out

    ⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

  11. locked and limited conversation to collaborators on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

freeze-slow-crash-leakinfo-neededjavascripttypescript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions