microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.79k stars 12.46k forks source link

electron_node tsserver.js cpu usage over 100% #44493

Open advafaeian opened 3 years ago

advafaeian commented 3 years ago

there is a problem with the react projects and vscode I work with. I've seen multiple similar issues across forums and here (including the one i posted before microsoft/vscode#98725) but none of them has a solid solution or at least explanation. the problem is electron_node tsserver.js cpu usage getting easily over 100% while editing a few component long project.

Steps to Reproduce:

  1. after npx creat-react--app and creating a react app, add a few component to the project.
  2. try to edit one file. electron_node tsserver.js cpu usage easily gets over 100%.
  3. it happens with insider version, and also all extensions (except js/ts language features) disabled:

vscode

tsserver verbose logs while producing the above: tsserver.log

mjbvz commented 3 years ago

Does this reproduce in the latest VS Code insiders build with all extensions disabled?

advafaeian commented 3 years ago

Yes, it reproduces in the insider version, with all extensions (except js/ts language features) disabled.

ShadowBelmolve commented 3 years ago

Same problem here, it only happens with typescript 4.3.2(builtin or from node_modules). With 4.2.4 it not occur.

Version:          Code 1.57.0 (b4c1bd0a9b03c749ea011b06c6d2676c8091a70c, 2021-06-09T17:18:42.895Z)
OS Version:       Linux x64 5.10.42-1-MANJARO
CPUs:             AMD Ryzen 9 5900X 12-Core Processor (24 x 3050)
Memory (System):  31.36GB (10.54GB free)
Load (avg):       3, 3, 2
VM:               0%
Screen Reader:    no
Process Argv:     --force-user-env --unity-launch --crash-reporter-id bb16e461-0546-404f-864c-2feba7163f71
GPU Status:       2d_canvas:                  unavailable_software
                  gpu_compositing:            disabled_software
                  multiple_raster_threads:    enabled_on
                  oop_rasterization:          disabled_off
                  opengl:                     disabled_off
                  rasterization:              disabled_software
                  skia_renderer:              enabled_on
                  video_decode:               disabled_software
                  vulkan:                     disabled_off
                  webgl:                      unavailable_software
                  webgl2:                     unavailable_software

CPU %   Mem MB     PID  Process
    0      161   60095  code main
    0       32   60098     zygote
    0       96   60142       gpu-process
    0        0   60144         broker
    0       32   60099     zygote
    0        0   60101       zygote
    0       96   84071         window (Process Explorer)
    0       64   60141     utility
    0      417   60162     window (● link.tsx - zettle - Visual Studio Code)
    0      193   60699       extensionHost
    0       64   60774         /var/lib/snapd/snap/code/66/usr/share/code/code /var/lib/snapd/snap/code/66/usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=60699
    0       64   60775         electron_node serverMain.js 
    0       96   60846         electron_node tailwindServer.js 
    0      193   60893         electron_node eslintServer.js 
    0      193   60946         node /home/renan/projects/codeby/zettle/node_modules/.bin/jest --testLocationInResults --json --useStderr --outputFile /tmp/jest_runner_zettle.json --watch --no-coverage --no-color --reporters default --reporters /home/renan/.vscode/extensions/orta.vscode-jest-4.0.3/out/reporter.js
    0       96   77268         electron_node tsserver.js 
    5      353   77269         electron_node tsserver.js 
    0       64   77284           electron_node typingsInstaller.js typesMap.js 
    0       64   60707       watcherService
    0       64   60798       searchService
    0       96   60655     shared-process
    0       64   60700       ptyHost
    0        0   91106     /bin/bash /var/lib/snapd/snap/code/66/usr/share/code/resources/app/out/vs/base/node/cpuUsage.sh 60095 60098 60099 60141 60162 60655 91105 60142 60101 60699 60707 60798 60700 60144 84071 60774 60775 60846 60893 60946 77268 77269 77284
    0        0   91130       sleep 1