dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 670 forks source link

OmniSharp.exe CPU consumption even when VS Code is not actively used #1913

Open yuribudilov opened 6 years ago

yuribudilov commented 6 years ago

Hello good people

This is more a question of what to expect rather than actual issue since I am new to VS Code.

dotnet 2.0.3 64-bit VS Code 1.18.1 64-bit (and 32-bit) Windows 10 desktop 64-bit

I am learning VS Code. I installed 1.18.1 64-bit (also tried 32-bit) and have a HelloWorld C# project using .Net Core 2.0.3 64-bit. I see in Windows Task Resource Monitor the OmniSharp.exe constantly using a lot of CPU, not 100% of 1 core but very close to ~25-50% of 1 logical core of my PC (quad core 64-bit i7) almost all of the time. While this is happening I am not actually using VS Code, it is just sitting there open but OmniSharp.exe eating CPU non-stop. The app is console dotnet hello-world so it can not be simpler.

Is this CPU utilization from OmniSharp.exe normal ? Many thanks.

robertwahler commented 6 years ago

This happens on macOS too. It usually happens after a Unity 3D build, the only fix is to shutdown VS Code and start it again.

dander commented 6 years ago

I just hit this issue. I keep a fairly large VS solution open for light-weight editing of files. I was noticing that while running a build in MSBuild from command line, or Visual Studio, my system became very sluggish. It would go back to normal a few seconds after the build ended. The problem went away after disabling the plugin.

rchande commented 6 years ago

@yuribudilov @robertwahler @dander, thanks for reporting this. We'd like to investigate this but need a performance trace in order to proceed. Could you please use PerfView to capture a trace of Omnisharp while it is consuming your CPU and share it somewhere? I can also provide more specific directions if you've never used PerfView before.

DustinCampbell commented 6 years ago

Note that PerfView is Windows-only.

rchande commented 6 years ago

@dander Thanks for the trace--replied offline with some additional requests.

yuribudilov commented 6 years ago

folks, I know it is closed but hopefully someone will read the comment. I left my VS Code open sitting idle over-night. OmniSharp.exe used up CPU all night and ate all memory, the working set was 16 GB (!!!), so was the Commit about 12 GB, it was paging heavily, reading pagefile.sys and eating 10-20% of the CPU. It is clearly broken. I am using latest version of VS Code 64-bit, Windows 10, .Net Core 2.1.2. I use Windows Resource Monitor to observe OmniSharp.exe.

yuribudilov commented 6 years ago

more info - I suspect there may be something in my project.assets.json or in my debug *.deps.json that is causing the problem. if you like to send me email I can reply with both files attached. As a new VS Code user/learner I may have done something in those files to upset OmniSharp.exe ??

yuribudilov commented 6 years ago

I now experience same problem (constant consumption of memory, non stop, with some CPU) on a very simple .Net Core C# project using latest versions of 64-bit software. I have forced a OmniSharp.GCDump of 600 MB from PerfView.exe. If anyone is interested, please email me with instructions of how I can make it available to you. I also collected ~500MB (90MB zipped) PerfViewData.etl.zip for a few minutes as OmniSharp.exe is running and eating memory.

Thank you.

rchande commented 6 years ago

@yuribudilov Can you please upload your ETL to OneDrive (or similar) and send me the link at Ravi.Chande@microsoft.com ? Thanks!

yuribudilov commented 6 years ago

sent email to Ravi from my hotmail account, please see if it made it and check the junk folder.

jgritten commented 6 years ago

Any update on this? OmniSharp is currently eating my machine alive. thanks

vladmyr commented 6 years ago

Bump. Any progress on this issue? Same here as above on Mac. Have to manually terminate the process from Resource Manager app.

rchande commented 6 years ago

@jgritten @vladmyr @yuribudilov Are any of you able to share a performance trace? I'm not longer able to access the one @yuribudilov originally shared with me.

vladmyr commented 6 years ago

@rchande I've sent you an email.

robertwahler commented 6 years ago

This makes me so sad. I guess my project has gotten too complicated. Even inserting a line break in a CS file causes a 15 to 20 second 400% CPU spike. I have to stop what I'm doing and wait for it to settle down as this CPU spike blocks responsive typing on a MBP running Sierra. I tried the latest beta 1.15.0-beta-6, same issue.

yuribudilov commented 6 years ago

I have uploaded the dumps again.....

rchande commented 6 years ago

@yuribudilov Thank you! I have downloaded and saved the dumps.

CanisLupus commented 5 years ago

Hey! Any news about this?

I'm now looking at the RAM used by OmniSharp slowly but steadily climb while simply having a Unity 3D project open in VSCode. After a few hours of normal work it easily gets to several GB.

Issue #2041 is also related, possibly others.

EDIT: In my case this happens in a project where there are 50-something .csproj files due to multiple assemblies being used in Unity. For other projects without more than a few assemblies this doesn't seem to happen, or at least it's not immediately visible.

haydenjameslee commented 4 years ago

@CanisLupus Sorry to revive an old thread but I just noticed the same thing in a Unity project seemingly coinciding with us splitting the project into many assembly definitions. Did you have any luck in solving it?

CanisLupus commented 4 years ago

@haydenjameslee Hey! No problem, but I haven't worked directly on that project since my previous post, so I can't tell if the problem still happens or not. We didn't do anything to fix it and last time we checked we restarted VSCode whenever we noticed Omnisharp taking several GBs of RAM. :(