Skip to content
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.js High CPU usage #32085

Closed
fotonmoton opened this issue Jun 25, 2019 · 12 comments
Closed

tsserver.js High CPU usage #32085

fotonmoton opened this issue Jun 25, 2019 · 12 comments
Assignees
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@fotonmoton
Copy link

Issue Type: Performance Issue

tsserver.js constantly using up to 120% of CPU even if nothing happening.

foton      590  2.0  1.7 1942636 290164 ?      Sl   13:08   0:17 /usr/share/code/code --type=renderer --no-sandbox --service-pipe-token=A216D35A621259A0C0B481D29BB512F6 --lang=en-US --app-path=/usr/share/code/resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#2e3440 --num-raster-threads=4 --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=A216D35A621259A0C0B481D29BB512F6 --renderer-client-id=7 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
foton      624  0.5  0.9 1219748 147324 ?      Sl   13:08   0:04 /usr/share/code/code --nolazy --inspect=47366 /usr/share/code/resources/app/out/bootstrap-fork --type=extensionHost
foton      676  0.0  0.4 996704 69680 ?        Sl   13:08   0:00 /usr/share/code/code /usr/share/code/resources/app/out/bootstrap-fork --type=watcherService
foton      695  117  1.7 1229440 287392 ?      Rl   13:08  15:54 /usr/share/code/code /usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /tmp/vscode-typescript/88399acf99a2f7a86c76/tscancellation-dbf5fe213afd4050de43.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation
foton      697  0.2  0.8 1074328 140940 ?      Sl   13:08   0:02 /usr/share/code/code /home/foton/.vscode/extensions/dbaeumer.vscode-eslint-1.9.0/server/out/eslintServer.js --node-ipc --clientProcessId=624
foton      771  0.2  0.5 1006880 83156 ?       Sl   13:08   0:01 /usr/share/code/code /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /home/foton/.cache/typescript/3.5 --enableTelemetry --typesMapLocation /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation
foton      874  0.0  0.3 964912 63128 ?        Sl   13:08   0:00 /usr/share/code/code /usr/share/code/resources/app/extensions/json-language-features/server/dist/jsonServerMain --node-ipc --clientProcessId=624
foton     8047  0.2  0.5 1120412 96956 ?       Sl   13:18   0:00 /usr/share/code/code --type=renderer --no-sandbox --service-pipe-token=A5450A4F3BE7B82537FEB2ADF80F9893 --lang=en-US --app-path=/usr/share/code/resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#2e3440 --num-raster-threads=4 --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=A5450A4F3BE7B82537FEB2ADF80F9893 --renderer-client-id=9 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
foton     9113  1.0  0.6 1149136 110552 ?      Sl   13:19   0:01 /usr/share/code/code --type=renderer --no-sandbox --service-pipe-token=69F6496F95F360D39FF03512B5E37C83 --lang=en-US --app-path=/usr/share/code/resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#2e3440 --num-raster-threads=4 --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=69F6496F95F360D39FF03512B5E37C83 --renderer-client-id=11 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
foton    13617  0.0  0.0   4628   864 ?        S    13:21   0:00 /bin/sh -c "/usr/share/code/resources/app/out/vs/base/node/cpuUsage.sh" 23645 23649 23693 23841
foton    13618  0.0  0.0  12884  3296 ?        S    13:21   0:00 /bin/bash /usr/share/code/resources/app/out/vs/base/node/cpuUsage.sh 23645 23649 23693 23841
foton    13630  0.0  0.0  14428  1012 pts/2    S+   13:21   0:00 grep --color=auto code
foton    23645  2.5  0.8 1572416 144304 ?      Ssl  11:59   2:06 /usr/share/code/code .
foton    23649  0.0  0.2 362020 40468 ?        S    11:59   0:00 /usr/share/code/code --type=zygote --no-sandbox
foton    23693  0.9  0.4 521616 80380 ?        Sl   11:59   0:44 /usr/share/code/code --type=gpu-process --no-sandbox --gpu-preferences=KAAAAAAAAACAAACAAQAAAAAAAAAAAGAAEAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAA --service-request-channel-token=DA435E0343A12CC796EB65F030FE8743
foton    23841  0.0  0.7 1179000 123948 ?      Sl   11:59   0:02 /usr/share/code/code --type=renderer --no-sandbox --service-pipe-token=42D74D3D9394404F25E80D3A2C8A8935 --lang=en-US --app-path=/usr/share/code/resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#2e3440 --disable-blink-features=Auxclick --num-raster-threads=4 --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=42D74D3D9394404F25E80D3A2C8A8935 --renderer-client-id=6 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101

VS Code version: Code 1.35.1 (c7d83e57cd18f18026a8162d042843bda1bcf21f, 2019-06-12T14:27:31.086Z)
OS version: Linux x64 4.15.0-51-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 2500)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
surface_synchronization: enabled_on
video_decode: unavailable_off
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 15.55GB (4.84GB free)
Process Argv .
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   127	 23645	code main
    0	    32	 23649	   zygote
    0	   111	 23841	     shared-process
    0	    80	 23693	   gpu-process
Workspace Info
|  Window (Controls.tsx - beditor - Visual Studio Code)
|    Folder (beditor): 72 files
|      File types: tsx(20) ts(15) js(13) map(4) eslintrc(3) json(2) jpg(2)
|                  ico(2) env(1) browserslistrc(1)
|      Conf files: package.json(1) tsconfig.json(1);
Extensions (19)
Extension Author (truncated) Version
meson asa 1.2.0
vscode-intelephense-client bme 1.0.14
vscode-eslint dba 1.9.0
EditorConfig Edi 0.13.0
php-debug fel 1.13.0
reasonml fre 1.0.38
42header kub 0.42.9
dune mae 0.0.5
dotenv mik 1.0.1
vscode-docker ms- 0.6.4
cpptools ms- 0.23.1
Go ms- 0.11.0
debugger-for-chrome msj 4.11.5
advanced-new-file pat 1.2.0
material-icon-theme PKi 3.8.0
sass-indented rob 1.5.1
code-settings-sync Sha 3.3.0
vscode-fileutils sle 2.14.5
polacode-fork Tox 0.5.1

(2 theme extensions excluded)

@fotonmoton fotonmoton changed the title High CPU usage tsserver.js High CPU usage Jun 25, 2019
@fotonmoton
Copy link
Author

downgrading to 1.35 or 1.34 fix the issue, tsserver peaks only when I type something.

@fotonmoton
Copy link
Author

Seems like downgrade do not resolve the problem. After some work tsserver again begin consume 100% CPU constantly in editor with two tabs opened and no action.
image

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 25, 2019
@sandersn sandersn added the Needs More Info The issue still hasn't been fully clarified label Jun 26, 2019
@sandersn
Copy link
Member

@fotonmoton can you do one of the following?

  1. Reduce the problem to a small repro.
  2. Share the code that causes the bug.
  3. Share the tsserver log from when the bug happens (see https://github.com/microsoft/TypeScript/wiki/Providing-Visual-Studio-Repro-Steps#typescript-server-log, and substitute “VS Code” for “VS”).

For [1], it is probably easiest to start by deleting your node_modules folder and checking whether the problem reproduces. If so, then the bug is exclusively in your code and you don’t have to worry about types from packages.

@sandersn
Copy link
Member

@fotonmoton I assigned this bug to you to gather more info. Please unassigned yourself when you are ready for me to look at it again.

@mjbvz
Copy link
Contributor

mjbvz commented Jun 26, 2019

For VS Code, collecting the TS Server log is actually much easier:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a tsserver.log file

@fotonmoton
Copy link
Author

fotonmoton commented Jun 27, 2019

@sandersn, ok, try to find out in which case tsserver peaks and create repo with code if I find something. @mjbvz Thanks for suggestion!

@fotonmoton
Copy link
Author

fotonmoton commented Jun 27, 2019

For now I upgrade VS Code to 1.35.1 and can't reproduce described behavior, I enable verbose tsserver log and if something happen will submit output.

@marques-p44
Copy link

I'm still having CPU issues as well. I'll attach my tsserver.log output.
tsserver-log-output.txt
Does anything jump out as to why it takes sometimes 8 - 12 seconds to finish typechecking?

@sandersn
Copy link
Member

sandersn commented Jul 3, 2019

@marques-p44 you have a number of packages with performance problems that have recently been fixed, like lodash and styled-components. I believe material-ui might have perf problems, though I'm not sure.

  1. Can you upgrade your dependencies to the latest version and see what perf is like?
  2. Can you open a new bug to track this issue? It's hard to know the root cause for perf problems, but it's likely different from that of @fotonmoton's problem.

@mjbvz
Copy link
Contributor

mjbvz commented Nov 6, 2019

Closing as it sounds like this is no longer reproducible for the original poster

@mjbvz mjbvz closed this as completed Nov 6, 2019
@gorjan-mishevski
Copy link

CPU at 1000% on macbook pro 2019, running the tslint plugin for intelij

@disarticulate
Copy link

so uh, this isn't even a plugin, it's just bundled with vscode now, i've had to set:

"typescript.tsserver.maxTsServerMemory": 0,
"typescript.tsserver.useSyntaxServer": "never",

I think vscode realized I was trying to kill it and it spun up and killed my server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

6 participants