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

Got 'Insufficient system resources exist to complete the requested service' while building Store version of application #10162

Open 0xNima opened 1 month ago

0xNima commented 1 month ago

Issue Description

Hello folks, When I tried to build the Store (MSIX) version of Telegram Desktop application in VS 2022, my build failed with the following logs:

1>Child node "4" exited prematurely. Shutting down. Diagnostic information may be found in files in "C:\....\Temp\MSBuildTemp\" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.

1>C:\....\Temp\MSBuildTemp\MSBuild_pid-18684_d6ae519576884d319a97c37f0006ed4e.failure.txt:1>UNHANDLED EXCEPTIONS FROM PROCESS 18684:

1>=====================

1>5/20/2024 7:22:27 PM

1>System.IO.IOException: Insufficient system resources exist to complete the requested service.

1>

1>   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

1>   at System.IO.Pipes.PipeStream.BeginWriteCore(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

1>   at System.IO.Pipes.PipeStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)

1>   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)

1>===================

1>

1>

1>C:\Users\...\Temp\MSBuildTemp\MSBuild_pid-28480_31fcd563a2c9411192e8b7de35718108.failure.txt:

1>UNHANDLED EXCEPTIONS FROM PROCESS 28480:

1>=====================

1>5/20/2024 7:22:26 PM

1>System.IO.IOException: Insufficient system resources exist to complete the requested service.

1>

1>   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

1>   at System.IO.Pipes.PipeStream.BeginWriteCore(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

1>   at System.IO.Pipes.PipeStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)

1>   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)

1>===================
....

Steps to Reproduce

1- install and build the solution according to instructions

2- Add a new Windows Application Packaging Project to the solution named store-release and config package name, icons, and etc.

3- Right Click on store-release and select Publish -> Create App Packages...

4- set Version, Architecture (x64), and Solution Configuration (Release x64)

5- click on Create button

Actual Behavior

UNHANDLED EXCEPTIONS FROM PROCESS 18684:

=====================
5/20/2024 7:22:27 PM
System.IO.IOException: Insufficient system resources exist to complete the requested service.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.PipeStream.BeginWriteCore(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
   at System.IO.Pipes.PipeStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
===================

Analysis

I'm not sure if this problem is merely related to resources, because CPU and RAM usage never hit the limits. I tried to stop some Event Trace Sessions in the Performance Monitoring window but it didn't help.

Note that I can build the solution successfully from Build -> Build Solution. The problem occurs when I try to build the app from Publish -> Create App Packages....

Versions & Configurations

the output of msbuild -version: MSBuild version 17.9.8+b34f75857 for .NET Framework 17.9.8.16306

Machine's configurations: Processor: 13th Gen Intel(R) Core(TM) i7-13650HX 2.60 GHz - 14 cores, 20 logical processors RAM: 32.0 GB OS: Windows 11 Home

JanKrivanek commented 3 weeks ago

@0xNima can you try adding -m:1 if it helps workaround the issue?

JanKrivanek commented 1 day ago

@JaynieBai - let's try to repro in VS build with the repo given by customer