dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.17k stars 1.34k forks source link

System.OutOfMemoryException building UE #8597

Open MaxAbernethy opened 1 year ago

MaxAbernethy commented 1 year ago

1>MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled. 1>MSBUILD : error : System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. 1>MSBUILD : error : at Go4(RegexRunner ) 1>MSBUILD : error : at System.Text.RegularExpressions.RegexRunner.Scan(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32 prevlen, Boolean quick, TimeSpan timeout) 1>MSBUILD : error : at System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32 prevlen, String input, Int32 beginning, Int32 length, Int32 startat) 1>MSBUILD : error : at System.Text.RegularExpressions.Regex.Match(String input, Int32 startat) 1>MSBUILD : error : at Microsoft.Build.Shared.CanonicalError.Parse(String message) 1>MSBUILD : error : at Microsoft.Build.Utilities.TaskLoggingHelper.LogMessageFromText(String lineOfText, MessageImportance messageImportance) 1>MSBUILD : error : at Microsoft.Build.Tasks.Exec.LogEventsFromTextOutput(String singleLine, MessageImportance messageImportance) 1>MSBUILD : error : at Microsoft.Build.Utilities.ToolTask.LogMessagesFromStandardErrorOrOutput(Queue dataQueue, ManualResetEvent dataAvailableSignal, MessageImportance messageImportance, StandardOutputOrErrorQueueType queueType) 1>MSBUILD : error : at Microsoft.Build.Utilities.ToolTask.HandleToolNotifications(Process proc) 1>MSBUILD : error : at Microsoft.Build.Utilities.ToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) 1>MSBUILD : error : at Microsoft.Build.Tasks.Exec.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) 1>MSBUILD : error : at Microsoft.Build.Utilities.ToolTask.Execute() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskBuilder.d26.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskBuilder.d24.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskBuilder.d19.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskBuilder.d18.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.TaskBuilder.d13.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TargetEntry.d51.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TargetEntry.d44.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at Microsoft.Build.BackEnd.TargetBuilder.d23.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.TargetBuilder.d10.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.RequestBuilder.d68.MoveNext() 1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown --- 1>MSBUILD : error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 1>MSBUILD : error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>MSBUILD : error : at Microsoft.Build.BackEnd.RequestBuilder.d__59.MoveNext()

jack-work commented 10 months ago

I get this error building a completely different project. I wouldn't doubt a quirk of the project i am building is at least in part responsible, but I'm not sure how to debug this. It looks like it's trying to parse some message that is being emitted during build and running out of memory whilst. If I could know what message this is, perhaps I can fix this in my codebase. If anyone has any advice I am all ears.

MarcelNehring commented 1 week ago

Saw a similar unhandled exception today when my system ran out of memory during a heavy parallelized build. I don't think that this is related to the project that is being built directly but rather to the fact that the host system runs out of memory.

Stack Trace

33>MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled
33>MSBUILD : error :     System.AggregateException: One or more errors occurred. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
33>MSBUILD : error :    at Go7(RegexRunner )
33>MSBUILD : error :    at System.Text.RegularExpressions.RegexRunner.Scan(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32 prevlen, Boolean quick, TimeSpan timeout)
33>MSBUILD : error :    at System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32 prevlen, String input, Int32 beginning, Int32 length, Int32 startat)
33>MSBUILD : error :    at System.Text.RegularExpressions.Regex.Match(String input, Int32 startat)
33>MSBUILD : error :    at Microsoft.Build.Shared.CanonicalError.Parse(String message)
33>MSBUILD : error :    at Microsoft.Build.Utilities.TaskLoggingHelper.LogMessageFromText(String lineOfText, MessageImportance messageImportance)
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.VCToolTask.LogEventsFromTextOutput(String singleLine, MessageImportance messageImportance)
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ToolOutputPipe.ProcessQueue()
33>MSBUILD : error :    at System.Threading.Tasks.Task.Execute()
33>MSBUILD : error :    --- End of inner exception stack trace ---
33>MSBUILD : error :    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
33>MSBUILD : error :    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ToolOutputPipe.OnProcessFinished()
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.TrackedVCToolTask.CloseToolOutputPipes()
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.d__24.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.d__19.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.d__18.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.d__13.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetEntry.d__51.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetEntry.d__44.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetBuilder.d__23.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetBuilder.d__10.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.d__68.MoveNext()
33>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
33>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
33>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
33>MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.d__59.MoveNext()
33>MSBUILD : error : ---> (Inner Exception #0) System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
33>MSBUILD : error :    at Go7(RegexRunner )
33>MSBUILD : error :    at System.Text.RegularExpressions.RegexRunner.Scan(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart, Int32 prevlen, Boolean quick, TimeSpan timeout)
33>MSBUILD : error :    at System.Text.RegularExpressions.Regex.Run(Boolean quick, Int32 prevlen, String input, Int32 beginning, Int32 length, Int32 startat)
33>MSBUILD : error :    at System.Text.RegularExpressions.Regex.Match(String input, Int32 startat)
33>MSBUILD : error :    at Microsoft.Build.Shared.CanonicalError.Parse(String message)
33>MSBUILD : error :    at Microsoft.Build.Utilities.TaskLoggingHelper.LogMessageFromText(String lineOfText, MessageImportance messageImportance)
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.VCToolTask.LogEventsFromTextOutput(String singleLine, MessageImportance messageImportance)
33>MSBUILD : error :    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ToolOutputPipe.ProcessQueue()
33>MSBUILD : error :    at System.Threading.Tasks.Task.Execute()<---
33>MSBUILD : error :`