21

To give some backstory, I used to have this issue on VS2012 as well. Randomly (not all the time), when I went to run my companies Web project on IE via vs2012, it would stall for a while and ultimately fail to load. I noticed my machine would essentially struggle to do anything, and come almost to a halt.

Checking the task manager would reveal HUNDREDS, if not THOUSANDS of MSBuild.exe and Conhost.exe instance spawned, filling every possible byte of memory that they could (max 8 gigs on machine). I only had a handful of solutions which needed to be built.

I never found out the real cause, but an eventual update to VS2012 I believe curbed that issue for several months.

Fast forward to today, I am now on a machine with 16 gigs of ram and am now running VS2015 14.0.23107.

I noticed recently that the issue of the the infinitely spawning MSBuild and Conhost was back, this time filling up all of my 16 gigs of memory.

I have searched the internet as much as I can, but I have not found any topics similar to what I am experiencing.

I know that this is a 'feature' from microsoft, as referenced here:

msbuild.exe staying open, locking files

and other places.

But no one I have seen has a problem where so many MSBuilds and Conhosts spawn that every single byte of memory is consumed by them, and you are forced to restart your machine or wait until they all die (which doesn't seem to happen after any particular set amount of time).

The only environment variables I can think of when this has happened recently are:

  1. I had at least 2 instances of VS2015 running
  2. I had just got done making changes and building one solution
  3. I went to run our web application on a solution that depends on the previous one I had just built.

Does anyone else have this issue, and did you ever find the cause?

-EDIT-

Update: I am not 100% if this fixed it, but I haven't gotten it since I made these changes.

Essentially, we have two different solutions here at work. They are very similar, only difference is that one of them has way less other projects/dependencies with it.

I switch between these two solutions often, and I believe the solution config for one of them had "Debug with Extended Diagnostics" checked for at least one project.

Also, I had the build options set to do up to 8 parallel builds at the same time.

Our devops manager thinks it is possible that, some kind of switching between the solutions mixed with the parallel builds caused some kind of corruption/error which spawned thousands of MSBuilds.

We have since fixed the problem with the "Debug with Extended Diagnostics" and I have changed my build options to be only 1 parallel build and have not had the issue since.

Community
  • 1
  • 1
GenjiGlove
  • 221
  • 2
  • 5

1 Answers1

21

Interestingly enough, I had the issue where a flood of MSBuild and conhost processes started springing up and killed all my memory. In my case, it was related to my testing with time zone features. I changed my OS time zone for testing/QA of a web app and this was the result for some reason. Something with Visual Studio doesn't like on-the-fly timezone changes.

techmell
  • 380
  • 3
  • 9
  • 3
    I'm testing a time zone related functionality of a web app and this problem arises. I am switching between different time zones before, during and after debug sessions. `taskkill /F /IM MSBuild.exe` kills them all, but they respawn after each build. – A.Kostadinov Aug 16 '16 at 09:10
  • 2
    @A.Kostadinov Yes, I believe it goes away if you change back to the original time zone you were on OR if you close Visual Studio and reopen. Any time zone change while VS is open seems to cause the problem. – techmell Sep 08 '16 at 00:39
  • exactly the same thing has happened to me. – sjclark76 Sep 20 '16 at 21:48
  • I had same thing. Also testing timezone changes – Ian1971 Apr 04 '17 at 10:29
  • Thanks, I was seeing this after moving timezones. I had to restart the machine to get rid of the existing ones. – Taran Sep 05 '17 at 16:03
  • It reproduced for me a lot of times and today I realized it happened also after timezone change. – aly Oct 10 '17 at 14:24
  • I also found that while the system was in this state, Resharper's unit test runner would not start (no errors were reported). That was what made me initially want to shut down studio and it was only when i looked in taskmanager to make sure my devenv was really gone that I noticed all the msbuilds – Andy Jun 08 '18 at 13:34
  • `taskkill /F /IM /T MSBuild.exe` will also remove orphaned `conhost.exe` processes – Arthur Stankevich Aug 21 '18 at 12:38