Look for apphost when considering node reuse#13368
Merged
rainersigwald merged 2 commits intodotnet:mainfrom Mar 11, 2026
Merged
Look for apphost when considering node reuse#13368rainersigwald merged 2 commits intodotnet:mainfrom
rainersigwald merged 2 commits intodotnet:mainfrom
Conversation
There was a collision between dotnet#13220 (at end of build, look for other running MSBuild processes and decide whether node reuse is likely to be worthwhile) and dotnet#13175 (use an apphost on core). This broke the overprovisioning detection, which was looking for `dotnet[.exe]` instead of the new `MSBuild[.exe]`. Always search for `MSBuild[.exe]` instead, and remove the now-unnecesary "try to filter `dotnet.exe` processes to those running `MSBuild.dll` code too.
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts system-wide node detection to account for the MSBuild apphost so over-provisioning detection/node reuse decisions look for MSBuild processes instead of dotnet.
Changes:
- Switch expected process name for node enumeration to MSBuild.
- Remove dotnet-specific command-line filtering intended to detect
MSBuild.dllunderdotnet.
Comments suppressed due to low confidence (2)
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs:644
- There are unit tests for the over-provisioning logic (
NodeProviderOutOfProc_Tests), but they overrideCountSystemWideActiveNodes, so thisGetProcessesByName-based enumeration path isn't covered. Consider adding a test that would fail if an extension (".exe") is accidentally passed intoGetProcessesByNameon Windows (e.g., by asserting the computed expected process name is extensionless).
var expectedProcessName = Constants.MSBuildExecutableName;
Process[] processes;
try
{
processes = Process.GetProcessesByName(expectedProcessName);
}
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs:644
Process.GetProcessesByNameexpects the process name without an extension.Constants.MSBuildExecutableNameisMSBuild.exeon Windows, so this will likely return an empty set on Windows and breakCountActiveNodesWithMode(server-node self-termination / over-provisioning detection). Use an extensionless name here (e.g.,Path.GetFileNameWithoutExtension(Constants.MSBuildExecutableName)orConstants.MSBuildAppName).
var expectedProcessName = Constants.MSBuildExecutableName;
Process[] processes;
try
{
processes = Process.GetProcessesByName(expectedProcessName);
}
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs
Outdated
Show resolved
Hide resolved
ViktorHofer
approved these changes
Mar 11, 2026
This was referenced Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a collision between #13220 (at end of build, look for other
running MSBuild processes and decide whether node reuse is likely to be
worthwhile) and #13175 (use an apphost on core). This broke the
overprovisioning detection, which was looking for
dotnetinsteadof the new
MSBuild.Always search for
MSBuildinstead, and remove the now-unnecesary"try to filter
dotnet.exeprocesses to those runningMSBuild.dllcode too.