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 CPU spikes on macOS #67258

Closed
renodubois opened this issue Jan 28, 2019 · 4 comments
Closed

tsserver.js CPU spikes on macOS #67258

renodubois opened this issue Jan 28, 2019 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster typescript Typescript support issues

Comments

@renodubois
Copy link

  • VSCode Version: 1.30.2
  • OS Version: macOS Mojave 10.14.2

I've seen some similar reports here, but I'm having occasional spikes of high CPU usage eminating from node_electron tsserver.js. This occurs both with and without extensions, although I can't seem to find a specific action that triggers it. Following some advice from other threads, I've made my TS log verbose and noticed this error showing up sometimes:

this.toPath is not a function

    TypeError: this.toPath is not a function
        at Object.Project.fileExists (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:121012:33)
        at tryGetModuleNameAsNodeModule (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:90131:43)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:89971:88
        at Object.mapDefined (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:601:30)
        at Object.getModuleSpecifiers (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:89971:29)
        at getSpecifierForModuleSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34547:62)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34425:39
        at Array.map (<anonymous>)
        at getSymbolChain (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34423:58)
        at lookupSymbolChain (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34407:52)
        at symbolToTypeNode (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34554:29)
        at typeToTypeNodeHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33840:28)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33653:106
        at withContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33694:37)
        at Object.typeToTypeNode (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33653:28)
        at getTypeNodeIfAccessible (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:109225:31)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:109186:50
        at Object.mapDefined (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:601:30)
        at annotateJSDocParameters (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:109181:32)
        at annotateParameters (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:109128:17)
        at doChange (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:109089:25)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:108992:109
        at Function.ChangeTracker.with (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:107652:17)
        at Object.getCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:108992:64)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:108638:121
        at Object.flatMap (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:504:25)
        at Object.getFixes (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:108638:23)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117737:35
        at Object.flatMap (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:504:25)
        at Object.getCodeFixesAtPosition (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117735:23)
        at IOSession.Session.getCodeFixes (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:125655:64)
        at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:124461:61)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:125824:88
        at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:125815:28)
        at IOSession.Session.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:125824:33)
        at IOSession.Session.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:125846:35)
        at Interface.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:127106:27)
        at emitOne (events.js:116:13)
        at Interface.emit (events.js:211:7)
        at Interface._onLine (readline.js:282:10)
        at Interface._normalWrite (readline.js:424:12)
        at Socket.ondata (readline.js:141:10)
        at emitOne (events.js:116:13)
        at Socket.emit (events.js:211:7)
        at addChunk (_stream_readable.js:263:12)
        at readableAddChunk (_stream_readable.js:250:11)
        at Socket.Readable.push (_stream_readable.js:208:10)
        at Pipe.onread (net.js:594:20)

I've also configured my tsconfig to only look at files that are included in my project, so I shouldn't have any libraries or anything included, as I noticed that was a common trend in some of the other projects.

I've also got a CPU Profile here when an instance of this was happening. I'm happy to provide any other details as needed. This is making work pretty annoying currently, as when the CPU spikes, my Intellisense stops working in a timely manner, and I am usually forced to restart my VS:Code instance.

@vscodebot
Copy link

vscodebot bot commented Jan 28, 2019

@vscodebot vscodebot bot added the typescript Typescript support issues label Jan 28, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Jan 28, 2019

Does this reproduce in the latest VS Code insiders build?

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Jan 28, 2019
@renodubois
Copy link
Author

Switched to using the Insider build and haven't seen any issues so far. I'll keep using it today and see if the issue crops up again (it has before, but that was on an older build so who knows)

@renodubois
Copy link
Author

After using Insiders all day, I haven't ran into any issues, so I'm gonna hope that it just stays good.

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

2 participants