Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

multithreading - error MSB4166: Child node exited prematurely. Shutting down

Sometimes my build fail with this error.

 0>MSBUILD : error MSB4166: Child node "3" exited prematurely. Shutting down.

It seems to be completely random and I've not been able to reproduce it at will. I'm running VS2010 Win7 x64 MSBuild 4.0 but this problem seems to be platform and OS independent. I'm building solutions in parallel (/m switch + BuildInParallel=True) and I don't want to disable this feature because I'm compiling application containing 800+ projects . Any idea how to solve it?

EDIT: When I installed .NET 4.5 developer preview, error logging was improved in the MSBuild 4.5 and now the error string looks like this:

error MSB4166: Child node "3" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt

I can find error log file in the Temp folder. This is content of MSBuild_*.failure.txt file:

System.InvalidOperationException: BuildEventArgs has formatted message while serializing!
   at Microsoft.Build.Framework.LazyFormattedBuildEventArgs.WriteToStream(BinaryWriter writer)
   at Microsoft.Build.Framework.BuildMessageEventArgs.WriteToStream(BinaryWriter writer)
   at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.PacketPumpProc()
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After a lot of time and research trying to fix this problem I found a solution that worked for me. I am using msbuild with /m and /p:BuildInParallel=true and the build was failing in the CI server. It was always failing in the second componen with the error:

error MSB4166: Child node "3" exited prematurely. Shutting down.

Adding /nodeReuse:false fixed the problem.

This is a good reference: https://blogs.msdn.microsoft.com/msbuild/2007/04/16/node-reuse-in-multiproc-msbuild/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...