_From @ktravelet on March 19, 2018 21:41_
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
The output below is from when all extensions are disabled.
Version: Code 1.21.1 (79b44aa704ce542d8ca4a3cc44cfca566e7720f1, 2018-03-14T14:39:09.335Z)
OS Version: Darwin x64 17.4.0
CPUs: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (8 x 2800)
Memory (System): 16.00GB (2.74GB free)
Load (avg): 2, 2, 2
VM: 0%
Screen Reader: no
Process Argv: /Applications/Visual Studio Code.app/Contents/MacOS/Electron
CPU % Mem MB PID Process
0 98 3905 code main
1 82 3906 gpu-process
0 82 3908 shared-process
2 279 11573 window (systemDetails.overview.js — Hanamon)
0 82 11577 extensionHost
1 295 11585 electron_node electronForkStart.js tsserver.js
70 98 11598 electron_node typingsInstaller.js tsserver.js typesMap.js
0 49 11988 electron_node jsonServerMain.js
0 49 11578 watcherService
0 33 11579 terminal
0 0 11580 /bin/bash -l
0 49 11897 node app.js
Workspace Stats:
| Window (systemDetails.overview.js — Hanamon)
| Folder (Hanamon): 627 files
| File types: js(382) css(48) html(39) json(25) md(23) png(15) map(12)
| ejs(9) sql(6) jpg(5)
| Conf files: package.json(4) makefile(2) launch.json(1) settings.json(1)
| jsconfig.json(1) grunt.js(1) gulp.js(1)
| webpack.config.js(1)
| Launch Configs: node
_Copied from original issue: Microsoft/vscode#46141_
_From @vscodebot[bot] on March 19, 2018 21:41_
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
_From @ktravelet on March 19, 2018 21:59_
See screenshot below. This is will all extensions off. I quit vscode at 2:49 and opened it again at 2:55. This time it only took 2 minutes to start eating CPU.
Please help, this is killing my battery life.
@ktravelet Can you please try collecting the typings installer log so that we can investigate:
"typescript.tsserver.log": "verbose"
in your user settings and restart vscodeOpen ts server log
command.ti-xxx.log
file in the opened directory. This file contains the typings installation logThanks
Wow, the log grew to 50mb in a few minutes. Do you have a secure place to upload this? There's some sensitive info in there.
Run code --upload-logs on the command line and follow instructions (code-insiders --upload-logs if using an insiders build) to upload the log and share the log id.
I am thinking this is to do with using polling watch on all the files and directories that typing installer decides to watch.
Closing this bug since there is no new information. Pleas reopen this bug when the logs are available.
I'm experiencing the same issue in VS Code 1.24.1 with high CPU usage from:
84 754 29777 electron_node electronForkStart.js tsserver.js
38 98 29789 electron_node typingsInstaller.js tsserver.js typesMap.js
I uploaded my logs:
Log file ID: 3107547623
@filmic in the log you provided there is a exception when opening file that could be causing this issue (leaks and extra watches etc). Can you try typescript@next to see if this is fixed.
@sandersn the exception in the log is in jsdoc tag binding. Is that fixed?
Cannot read property 'kind' of undefined
TypeError: Cannot read property 'kind' of undefined
at Object.isIdentifier (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:11585:20)
at getDeclarationIdentifier (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:11403:19)
at nameForNamelessJSDocTypedef (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:11366:20)
at getNameOfJSDocTypedef (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:11406:36)
at Object.getNameOfDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:11449:24)
at Object.hasDynamicName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:9619:23)
at declareSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:18960:33)
at bindBlockScopedDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20075:21)
at delayedBindJSDocTypedefTag (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20100:21)
at bindSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:18851:17)
at Object.bindSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:18801:9)
at initializeTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:43773:20)
at Object.createTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23236:9)
at Object.getTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:65352:79)
at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:89897:21)
at Object.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:89934:13)
at ConfiguredProject.Project.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:93323:53)
at ConfiguredProject.Project.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:93271:42)
at ConfiguredProject.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:93641:61)
at ProjectService.addFilesToNonInferredProjectAndUpdateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:94684:25)
at ProjectService.createConfiguredProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:94700:22)
at ProjectService.openClientFileWithNormalizedPath (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:95082:44)
at IOSession.Session.openClientFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:96543:37)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:95715:31)
at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:97230:88
at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:97221:28)
at IOSession.Session.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:97230:33)
at IOSession.Session.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:97250:35)
at Interface.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:98456:27)
at emitOne (events.js:96:13)
at Interface.emit (events.js:191:7)
at Interface._onLine (readline.js:241:10)
at Interface._normalWrite (readline.js:384:12)
at Socket.ondata (readline.js:101:10)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at Pipe.onread (net.js:560:20)
If I had to guess, the problem may have started in #23947 (May 17, which I believe shipped with 2.9), where I changed typedef binding quite a bit, including standardising on getNameOfDeclaration to get the name for typedefs. Previously the language service used its own duplicate of the code.
If it's possible, @filmic, can you look for @typedef
s in your project (or its dependencies)? One of them is causing the crash, so if you delete it, you should see the CPU usage go down. If you can isolate a repro, please let me know.
@sandersn It is a JavaScript (quite large) not TypeScript project but I found 10 occurrences of @typedef
If I remove that particular one:
/**
* @typedef {Array.<PoolCalculatedOddsResultsView~event>} PoolCalculatedOddsResultsView~result
*/
the CPU usage goes down to 0%.
File source: https://gist.github.com/filmic/8d573005e54394ffdd781f8af9104f6a
I also noticed I can achieve the same effect (0% CPU) if I set that in VS Code settings:
"typescript.disableAutomaticTypeAcquisition": true
@sheetalkamat Could you advise me how to use typescript@next in VS Code?
I don't use typescript as a dependancy in my project.
Documentation on using typescript@next.
@filmic Thanks! That repros on master too, so you don't need to bother with typescript@next yet.
(It makes sense that this is a JS project since TS doesn't try to bind @typedef
comments, which is where the crash happens.)
Here is an even smaller repro:
class C {
/**
* @typedef {C~A} C~B
* @typedef {object} C~A
*/
/** @param {C~A} o */
constructor(o) {
}
}
I'm pretty sure this is a different issue than the OP was running into, so I filed #25104 to track it instead. Thanks again for the repro @filmic. It crashes even from the command line compiler.
@filmic I just merged the fix for #25104 so typescript@next
will have it by tomorrow.
Same issue here, bump!
We need tsserver logs using typescript nightly drop for us to be able to investigate this.
You can upload logs by following these steps:
open tsserver log
from command palettecode --upload-logs
on the command line (or code-insiders --upload-logs
if using vscode insiders) and follow instructions and Then share the log file IDI encounter the same issue with
/** @typedef {Object<string, string | null> SourcemapToOriginFileMap */
Most helpful comment
@sandersn It is a JavaScript (quite large) not TypeScript project but I found 10 occurrences of
@typedef
If I remove that particular one:
the CPU usage goes down to 0%.
File source: https://gist.github.com/filmic/8d573005e54394ffdd781f8af9104f6a
I also noticed I can achieve the same effect (0% CPU) if I set that in VS Code settings:
"typescript.disableAutomaticTypeAcquisition": true
@sheetalkamat Could you advise me how to use typescript@next in VS Code?
I don't use typescript as a dependancy in my project.