msbuild: Very high memory consumption during build (4GB) with binary log enabled

From @rynowak on June 4, 2017 1:1

Apologies if this is not the right place. Please redirect me if you want me to put this info somewhere else.

/cc @rainersigwald

Repo Steps:

clone https://github.com/aspnet/Mvc run build.cmd

dotnet --info

.NET Command Line Tools (2.0.0-preview2-006215)

Product Information:
 Version:            2.0.0-preview2-006215
 Commit SHA-1 hash:  e67962b0de

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Users\rynowak\.dotnet\x64\sdk\2.0.0-preview2-006215\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002111-00
  Build    : 1ff021936263d492539399688f46fd3827169983

Here’s a dump image

dotnet.zip

Copied from original issue: dotnet/sdk#1299

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 28 (28 by maintainers)

Most upvoted comments

I think the memory consumption is fixed by #6155.

Yes the workaround is to change this line: https://github.com/aspnet/KoreBuild/blob/dev/build/KoreBuild.ps1#L130

from:

/bl:"$msbuildLogFilePath"

to:

/logger:BinaryLogger,C:\Users\kirillo\.dotnet\x64\sdk\2.0.0-preview2-006341\Microsoft.Build.dll;"$msbuildLogFilePath"

You’ll need to replace the path to Microsoft.Build.dll on the build machine, I don’t know how to do that from Powershell (what variable is available to find the location of MSBuild being used for the build?)

How do I turn off the tests? Build.cmd doesn’t accept any parameters?

Run build.cmd /t:Package That will stop at producing package stage and will not run tests. Is there a work-around apart from disabling BinaryLogger? This caused #2164 to happen. i.e. If system does not have high amount of RAM available, it crashes during compilation. (specifically Ubuntu)

I’m seeing even worse memory problems if I use a diagnostic-level text log (5 GB commit size). So it’s nothing specific to the binary logger.

The event args instances are held by the SingleProducerSingleConsumerQueue<object> which is in the _loggingQueue. Now to determine why is the queue so long - does it take too long for the logger to drain items?

image

You could turn off /bl by editing .build/KoreBuild.ps1 - that’s where the .rsp is generated