Skip to content

Why MSBuildServer_Tests.CanShutdownServerProcess fails when NodeProviderInProc._nodeContexts capacity is set? #12187

@surayya-MS

Description

@surayya-MS

Context

This came up while implementing multi-threaded MSBuild feature, specifically allowing NodeProviderInProc to spawn multiple nodes instead of just one. When initializing the dictionary for the nodes, it makes sense to set capacity equal to BuildParameters.MaxNodeCountto improve performance, but that made this test fail Microsoft.Build.Engine.UnitTests.MSBuildServer_Tests.CanShutdownServerProcess(byBuildManager: True)
with call stack trace:

at Microsoft.Build.BackEnd.NodeManager.InitializeComponent(IBuildComponentHost host) in /_/src/Build/BackEnd/Components/Communications/NodeManager.cs:line 175
   at Microsoft.Build.BackEnd.BuildComponentFactoryCollection.BuildComponentEntry.GetInstance(IBuildComponentHost host) in /_/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs:line 229
   at Microsoft.Build.BackEnd.BuildComponentFactoryCollection.GetComponent(BuildComponentType type) in /_/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs:line 166
   at Microsoft.Build.Execution.BuildManager.Microsoft.Build.BackEnd.IBuildComponentHost.GetComponent(BuildComponentType type) in /_/src/Build/BackEnd/BuildManager/BuildManager.cs:line 1289
   at Microsoft.Build.Execution.BuildManager.ShutdownAllNodes() in /_/src/Build/BackEnd/BuildManager/BuildManager.cs:line 1237
   at Microsoft.Build.Engine.UnitTests.MSBuildServer_Tests.CanShutdownServerProcess(Boolean byBuildManager) in /Users/runner/work/1/s/src/MSBuild.UnitTests/MSBuildServer_Tests.cs:line 254

Read more about it here

We should be able to set cpacity here

_nodeContexts = new Dictionary<int, NodeContext>();

and investigate why the test fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Our Own BuildProblems affecting the build or build infrastructure of the MSBuild repo itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions