Vscode-ng-language-service: Zombie processes throughout the day

Created on 23 Dec 2016  路  28Comments  路  Source: angular/vscode-ng-language-service

So I've found that throughout the day, my angular-cli gets slower and slower and I wondered what it was until I checked my Activity Monitor in OSX.
I noticed quite a few zombie processes towards the end of the day. Previous version of this language-service gave me between 2-5 zombie processes and I think with the latest version I seem to end up with 1 left. I've added a few details/screenshots in this issue about them: https://github.com/Microsoft/vscode/issues/17156

Is there any way I can help with getting some more information about them?

bug

Most helpful comment

Our current plan is to share a server with TypeScript instead of using our own service. This should take care of this issue. I will keep this issue up-to-date with the progress of that transition.

All 28 comments

I have the same problem

me to i have this process it killing my lap top (heat and the fan never stop ?)

Our current plan is to share a server with TypeScript instead of using our own service. This should take care of this issue. I will keep this issue up-to-date with the progress of that transition.

thank you @chuckjaz and other one for the amazing work on this plug-in

It's my favorite tools after leaving "Silverlight XAML and visual studio"

Is this also the issue that the process is spiking to 100% CPU usage?

I believe they are related.

Are there any plans to address this in the near future. Having to manually kill these processes can be annoying.
I really don`t want to seem impatient. Just asking out of interest.

Now that 4.0.0 is almost out and I have more time to focus on this, my plan is to knock this out one way or the other.

This extension is still spiking my code helper CPU to 100%.

I really need a way of reproducing this. Can you try an narrow down either a project or send me a log of the output window?

@bpasero @jrieken Could one of you help us out on this? Or add someone to the conversation. What's the best way of debugging it? Which commands can I use?

One thing we could investigate into is to at least shutdown any process that is a child of the main VS Code process on shutdown to prevent zombie processes from hanging around. I also often see TS-Server processes hanging around without having any VS Code instance opened.

I'm not sure anymore if this is related to zombie processes. The extension is just eating my CPU at 100%. I reenabled the extension again now and waiting untill it happens again. I'd like to know what I can do in order to debug this.

Right, as for debugging high CPU processes other than the main and renderer process I think we have no solution. I know that @jrieken enabled CPU profiling for our main and renderer processes and maybe we could expand this to extensions as well. However, the challenge is that the process to profile is most often not even the extension host process but the language server forked from there, so the profiling code would have to be added to each extension. Would be nicer if there was some way of profiling a process remotely, without requiring code changes.

screen shot 2017-04-07 at 14 20 29

96.1 sam  9649  /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/sam/.vscode/extensions/Angular.ng-template-0.1.2/node_modules/vscode-languageclient/lib/utils/electronForkStart /Users/sam/.vscode/extensions/Angular.ng-template-0.1.2/server/server.js --node-ipc

I now also enabled TSServer logging as suggested in this thread https://github.com/Microsoft/vscode/issues/20260.

@chuckjaz I noticed that this always happens when I used VS Code, leave it open and then put my mac to sleep. After a while when I unlock my mac again and start using Code, the process starts to use 100% CPU.

@mjbvz Do you have a way of debugging/testing this? I now have a stack tsserver.log file.

Info 0    Binding...
Info 1    request: {"seq":0,"type":"request","command":"configure","arguments":{"hostInfo":"vscode"}}
Info 2    Host information vscode
Info 3    response: {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 4    0::configure: async elapsed time (in milliseconds) 1.8224
Info 5    request: {"seq":1,"type":"request","command":"compilerOptionsForInferredProjects","arguments":{"options":{"module":"CommonJS","target":"ES6","allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"allowJs":true,"jsx":"Preserve"}}}
Perf 6    1::compilerOptionsForInferredProjects: elapsed time (in milliseconds) 0.7151
Info 7    response: {"seq":0,"type":"response","command":"compilerOptionsForInferredProjects","request_seq":1,"success":true,"body":true}
Info 8    request: {"seq":2,"type":"request","command":"getSupportedCodeFixes","arguments":null}
Perf 9    2::getSupportedCodeFixes: elapsed time (in milliseconds) 0.2105
Info 10   response: {"seq":0,"type":"response","command":"getSupportedCodeFixes","request_seq":2,"success":true,"body":["2304","2339","2377","2420","2503","2515","2653","2663","2686","2689","6133","6138","17009"]}
Info 11   request: {"seq":3,"type":"request","command":"getSupportedCodeFixes","arguments":null}
Perf 12   3::getSupportedCodeFixes: elapsed time (in milliseconds) 0.4345
Info 13   response: {"seq":0,"type":"response","command":"getSupportedCodeFixes","request_seq":3,"success":true,"body":["2304","2339","2377","2420","2503","2515","2653","2663","2686","2689","6133","6138","17009"]}
Info 14   request: {"seq":4,"type":"request","command":"open","arguments":{"file":"/Users/sam/Projects/opensource/dev-time/test.js","fileContent":"import test from 'ava';\nimport moment from 'moment-timezone';\nimport Conf from 'conf';\nimport m from './';\n\nconst conf = new Conf();\n\ntest.beforeEach(() => {\n\tconf.clear();\n});\n\ntest('error', t => {\n\tt.throws(m(), 'Expected a user');\n});\n\ntest('result', async t => {\n\tconst time = await m('SamVerschueren');\n\n\tt.is(conf.get('SamVerschueren'), moment().tz('Europe/Brussels').format());\n\tt.is(time, moment().tz('Europe/Brussels').format());\n});\n","scriptKindName":"JS"}}
Info 15   Search path: /Users/sam/Projects/opensource/dev-time
Info 16   No config files found.
Info 17   Add watcher for: /Users/sam/Projects/opensource/dev-time
Info 18   Add watcher for: /Users/sam/Projects/opensource
Info 19   Add watcher for: /Users/sam/Projects
Info 20   Add watcher for: /Users/sam
Info 21   Add watcher for: /Users
Info 22   Scheduling throttled operation: {"projectName":"/dev/null/inferredProject1*","fileNames":["/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es6.d.ts","/Users/sam/Projects/opensource/dev-time/index.js","/Users/sam/Projects/opensource/dev-time/test.js"],"compilerOptions":{"module":1,"target":2,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"allowJs":true,"jsx":1,"noEmitForJsFiles":true,"maxNodeModuleJsDepth":2},"typeAcquisition":{"enable":true,"include":[],"exclude":[]},"unresolvedImports":["ava","child_process","crypto","events","events","execa","fs","http","latest-push","net","readline","stream","tls"],"projectRootPath":"","kind":"discover"}
Info 23   Project '/dev/null/inferredProject1*' (Inferred) 0
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es6.d.ts
/Users/sam/Library/Caches/typescript/node_modules/moment/moment.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/moment-timezone/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/conf/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/tempfile/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/node/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/minimatch/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/glob/index.d.ts
/Users/sam/Library/Caches/typescript/node_modules/@types/del/index.d.ts
/Users/sam/Projects/opensource/dev-time/index.js
/Users/sam/Projects/opensource/dev-time/test.js

-----------------------------------------------
Open files: 
/Users/sam/Projects/opensource/dev-time/test.js
Info 24   event: {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"/Users/sam/Projects/opensource/dev-time/test.js","diagnostics":[]}}
Perf 25   4::open: async elapsed time (in milliseconds) 961.5712
Info 26   Sending request: {"projectName":"/dev/null/inferredProject1*","fileNames":["/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es6.d.ts","/Users/sam/Projects/opensource/dev-time/index.js","/Users/sam/Projects/opensource/dev-time/test.js"],"compilerOptions":{"module":1,"target":2,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"allowJs":true,"jsx":1,"noEmitForJsFiles":true,"maxNodeModuleJsDepth":2},"typeAcquisition":{"enable":true,"include":[],"exclude":[]},"unresolvedImports":["ava","child_process","crypto","events","events","execa","fs","http","latest-push","net","readline","stream","tls"],"projectRootPath":"","kind":"discover"}
Info 27   Received response: {"projectName":"/dev/null/inferredProject1*","typeAcquisition":{"enable":true,"include":[],"exclude":[]},"compilerOptions":{"module":1,"target":2,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"allowJs":true,"jsx":1,"noEmitForJsFiles":true,"maxNodeModuleJsDepth":2},"typings":["/Users/sam/Library/Caches/typescript/node_modules/@types/conf/index.d.ts","/Users/sam/Library/Caches/typescript/node_modules/@types/del/index.d.ts","/Users/sam/Library/Caches/typescript/node_modules/@types/moment-timezone/index.d.ts","/Users/sam/Library/Caches/typescript/node_modules/@types/tempfile/index.d.ts","/Users/sam/Library/Caches/typescript/node_modules/@types/node/index.d.ts"],"unresolvedImports":["ava","child_process","crypto","events","events","execa","fs","http","latest-push","net","readline","stream","tls"],"kind":"action::set"}
Info 28   request: {"seq":5,"type":"request","command":"quickinfo","arguments":{"file":"/Users/sam/Projects/opensource/dev-time/test.js","line":13,"offset":16}}
Perf 29   5::quickinfo: elapsed time (in milliseconds) 3.0767
Info 30   response: {"seq":0,"type":"response","command":"quickinfo","request_seq":5,"success":false,"message":"No content available."}

It doesn't look like it's doing much.

@kieferrm saw this recently as well. We're trying to track down a reliable repo.

@SamVerschueren can you check to see if your problem reproduces with this extension disabled? It looks like Angular.ng-template-0.1.2/server/server.js is the culprit here, not tsserver itself directly

It's definitely the extension here. Don't experience any problems when I disable it. Multiple people complain about it on Twitter as well about CPU rising to 100% after installing this extension. But this one is really a must have for all the Angular developers. That's why it would be very nice if we could track down the root cause of this.

These lines are suspicious:

Info 17 Add watcher for: /Users/sam/Projects/opensource/dev-time Info 18 Add watcher for: /Users/sam/Projects/opensource Info 19 Add watcher for: /Users/sam/Projects Info 20 Add watcher for: /Users/sam Info 21 Add watcher for: /Users

I thought I had killed the code that added this but I must not have. I will get another version out this week-end that makes sure these never happen.

Those got my attention as well. Let me know if I can help you out with test-running it.

seeing this as well on my machine

Don't know if it's related, but I also got a few reports for my Vue language server crashes and abnormally high CPU / Memory usage.

Seems some language server crashes leave zombie processes hanging. Don't know the details yet, though.

I have noticed the same thing for go as well. This seems like a general problem with vscode extensions.

My approach so far as been to ensure my processes go to zero CPU over time. At least the zombies are only taking swap space.

I am also moving to use be a plugin to the typescript language service instead of vscode directly now that 2.3 is out. This means that my zombies are no worse than typescript's.

Just wondering if there's any update here as to the progress of @angular/language-service as a TS Plugin rather than VSC. I can't really find any mention of it and the issue tracker had closed the original issue for it: https://github.com/angular/angular/issues/7482

I keep seeing commits/work being done for the language-service and came to the realisation that it's still not in CLI and it's installation isn't mentioned anywhere :)

I guess there's still work to be done before we can replace the VSC plugin with the below right?

"plugins": [
  {
    "name": "@angular/language-service"
  }
]

We ran into an issue that require a protocol change between VS Code and TypeScript. The current estimate from Microsoft as this change will roll our early in September.

The Angular language service can now be used as a VSC plugin, a TS Plugin, or a standalone language server. Closing; please open a new issue if you are experiencing this.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings